Skip to content

Fix white flash when navigating between calculator tabs#887

Merged
SakshiKekre merged 3 commits intomainfrom
fix/calculator-provider-flash
Apr 4, 2026
Merged

Fix white flash when navigating between calculator tabs#887
SakshiKekre merged 3 commits intomainfrom
fix/calculator-provider-flash

Conversation

@SakshiKekre
Copy link
Copy Markdown
Collaborator

Summary

  • Moves CalculatorProviders from individual page files into the shared [countryId]/layout.tsx
  • Previously, every page wrapped its content in <CalculatorProviders>, causing the entire provider tree (Redux store, React Query client, metadata bootstrap) to tear down and rebuild on every navigation
  • Now providers persist across page navigations — only the page content swaps

What changed

  • calculator-app/src/app/[countryId]/layout.tsx — wraps {children} with <CalculatorProviders>
  • All 10 page files under [countryId]/ — removed <CalculatorProviders> wrapper

Test plan

  • Navigate between Simulations, Policies, Households, Reports tabs — no white flash
  • Navigate to create pages (simulations/create, households/create, policies/create) — still works
  • Report builder and report output pages — still works
  • Sidebar state persists across tab navigation
  • Redux state (e.g. selected country) persists across navigations

🤖 Generated with Claude Code

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 31, 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 Apr 2, 2026 10:23pm
policyengine-calculator Ready Ready Preview, Comment Apr 2, 2026 10:23pm
policyengine-calculator-next Ready Ready Preview, Comment Apr 2, 2026 10:23pm
policyengine-website Ready Ready Preview, Comment Apr 2, 2026 10:23pm

Request Review

…ations

StandardLayout was being mounted per-page, causing the sidebar and header
to unmount/remount on every navigation. Moving it to the shared layout
keeps it mounted across page transitions, matching Vite's behavior.

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