Skip to content

Extract report builder routes to Next.js#862

Open
SakshiKekre wants to merge 1 commit intonextjs-calculator-migrationfrom
feat/extract-report-builder-routes
Open

Extract report builder routes to Next.js#862
SakshiKekre wants to merge 1 commit intonextjs-calculator-migrationfrom
feat/extract-report-builder-routes

Conversation

@SakshiKekre
Copy link
Collaborator

@SakshiKekre SakshiKekre commented Mar 25, 2026

Summary

  • Extracts ReportBuilderPage and ModifyReportPage from the React Router catch-all to dedicated Next.js file-based routes ([countryId]/reports/create/ and [countryId]/reports/create/[userReportId]/)
  • Migrates react-router-dom imports (useNavigate, useLocation, useParams) to the router abstraction layer (useAppNavigate, useAppLocation, prop passing)
  • Converts location.state usage in ModifyReportPage to query params (?from=report-output&reportPath=...) for cross-router compatibility
  • Updates the one caller (ReportOutput.page.tsx) that passes location.state to use query params instead
  • Adds ModifyReportPageRoute bridge wrapper in CalculatorRouter so the Vite app continues to work via useParams

Dependent PR

#869 (report output extraction) is based on this branch. It will be merged into this branch before everything merges up to #851 → main. See #851 for the full merge strategy.

Route mapping

React Router path Next.js route file
/:countryId/reports/create calculator-app/src/app/[countryId]/reports/create/page.tsx
/:countryId/reports/create/:userReportId calculator-app/src/app/[countryId]/reports/create/[userReportId]/page.tsx

Test plan

  • cd calculator-app && bun run dev — navigate to /us/reports/create, create a report
  • Navigate to /us/reports/create/<id> — verify modify page loads with report data
  • Verify back breadcrumb navigates to reports list
  • From report output, click "View setup" — verify query params (?from=report-output&reportPath=...) pass through and back navigation works
  • cd app && VITE_APP_MODE=calculator npx vite — Vite dev server still works for both routes
  • bun run test — all 2950 tests pass
  • bun run lint — no errors
  • bun run typecheck — passes (app + calculator-app)

@vercel
Copy link

vercel bot commented Mar 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
policyengine-app-v2 Ready Ready Preview, Comment Mar 25, 2026 11:18pm
policyengine-calculator Ready Ready Preview, Comment Mar 25, 2026 11:18pm
policyengine-website Ready Ready Preview, Comment Mar 25, 2026 11:18pm

Request Review

Migrate ReportBuilderPage and ModifyReportPage from the React Router
catch-all to dedicated Next.js file-based routes:
- [countryId]/reports/create/page.tsx → ReportBuilderPage
- [countryId]/reports/create/[userReportId]/page.tsx → ModifyReportPage

Swap react-router-dom imports to router abstraction in page components
and ReportBuilderShell. ModifyReportPage now accepts userReportId as a
prop (bridged via wrapper in CalculatorRouter for Vite, via Next.js
params for calculator-app). Convert location.state usage to query params
for cross-router compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant