Skip to content

Extract pathway wrappers to Next.js routes#870

Open
SakshiKekre wants to merge 1 commit intonextjs-calculator-migrationfrom
feat/extract-pathway-wrappers
Open

Extract pathway wrappers to Next.js routes#870
SakshiKekre wants to merge 1 commit intonextjs-calculator-migrationfrom
feat/extract-pathway-wrappers

Conversation

@SakshiKekre
Copy link
Collaborator

Summary

  • Swap useNavigateuseAppNavigate in SimulationPathwayWrapper, PopulationPathwayWrapper, PolicyPathwayWrapper
  • Add Next.js route pages: [countryId]/simulations/create, [countryId]/households/create, [countryId]/policies/create
  • Pathway wrappers manage their own StandardLayout internally, so pages only wrap with CalculatorProviders

Route mapping

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

Test plan

  • cd calculator-app && bun run dev — navigate to /us/simulations/create, /us/households/create, /us/policies/create
  • Cancel/complete flows navigate back to listing pages
  • Vite dev server still works for all three routes
  • bun run build in calculator-app — no errors
  • bun run lint in app — no errors

@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:31pm
policyengine-calculator Ready Ready Preview, Comment Mar 25, 2026 11:31pm
policyengine-website Ready Ready Preview, Comment Mar 25, 2026 11:31pm

Request Review

@anth-volk
Copy link
Collaborator

Review findings — PR #870 (Extract pathway wrappers)

Code reviewer found no issues at confidence >= 80 — clean PR overall.

HIGH

  1. Default switch cases render raw error text with no recovery UISimulationPathwayWrapper has switch cases that fall through to raw <Text style={{ color: colors.error }}>Unknown step/sub-step</Text> with no logging, no back button, and no way for users to recover. Should at minimum log the unexpected value and provide a navigation escape.

MEDIUM

  1. Variable naming inconsistency — PR uses const navigate = useAppNavigate() but all other consumers of useAppNavigate in the codebase use const nav = useAppNavigate(). This inconsistency makes searching and refactoring harder.

  2. Repeated cancel callback in SimulationPathwayWrapper — 10 nearly identical onCancel={() => navigate.push(...)} lambdas in the same component. Could be extracted to a single handleCancel callback.

  3. onComplete?.() has no error boundary — If the optional onComplete callback throws, it will crash the component tree with no catch.


🤖 Generated with Claude Code

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.

2 participants