Skip to content

Replace model iframe with Vercel rewrite#808

Open
MaxGhenis wants to merge 3 commits intomainfrom
model-rewrite
Open

Replace model iframe with Vercel rewrite#808
MaxGhenis wants to merge 3 commits intomainfrom
model-rewrite

Conversation

@MaxGhenis
Copy link
Contributor

Summary

  • Replaces the iframe embed of policyengine-model with a Vercel rewrite, serving the model app directly at /:countryId/model
  • Users now get the full sidebar navigation with all new pages (Parameters, Variables, Calibration, Validation) instead of the old single-scroll embed
  • Eliminates all iframe-related issues (height clipping, cross-origin IntersectionObserver, postMessage protocol)
  • Supersedes Auto-resize model iframe via postMessage #807

Changes

  • vercel.json: Add rewrite /:countryId/modelpolicyengine-model.vercel.app/?country=:countryId (before SPA catch-all)
  • WebsiteRouter.tsx: Remove model route (Vercel handles it now), convert /methodology redirect to full-page navigation
  • NavItem.tsx: Add reloadDocument prop to force full page load for Vercel-rewritten routes
  • HomeHeader.tsx: Mark Model nav link with reloadDocument: true

How it works

The model app's Vite base is set to https://policyengine-model.vercel.app/ so all asset references (JS, CSS) point directly to the model CDN. Only the HTML page is proxied through the Vercel rewrite — no asset path conflicts.

Test plan

  • Visit /us/model — full model site with sidebar nav loads
  • Click sidebar links (Parameters, Variables, etc.) — hash routing works
  • Click "Model" in top nav — triggers full page load, shows model site
  • Visit /us/methodology — redirects to /us/model
  • Visit /uk/model — UK content, behavioural spelling
  • Logo in model sidebar links back to policyengine.org

🤖 Generated with Claude Code

The model page was embedded via iframe which hid the sidebar navigation
and all the new pages (Parameters, Variables, Calibration, Validation).
Now uses a Vercel rewrite to serve the model app directly at /:countryId/model,
giving users the full sidebar-based layout.

- Add Vercel rewrite: /:countryId/model -> policyengine-model.vercel.app
- Remove Model.page.tsx iframe route from React Router
- Add reloadDocument to Model nav link for full page navigation
- Convert /methodology redirect to window.location for Vercel handling

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Mar 9, 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 10, 2026 9:29am
policyengine-calculator Ready Ready Preview, Comment Mar 10, 2026 9:29am

Request Review

MaxGhenis and others added 2 commits March 10, 2026 05:27
Adds "API" nav item between Model and About, linking to /us/api
(household API documentation). Uses reloadDocument since it's a
Vercel-rewritten route.

Co-Authored-By: Claude Opus 4.6 <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