Skip to content

fix(ui): toolbar tabs unresponsive on static builds when landing with a toolbar-panel param#3645

Merged
felipefreitag merged 1 commit into
canaryfrom
fix/toolbar-tab-navigation-static
Jul 10, 2026
Merged

fix(ui): toolbar tabs unresponsive on static builds when landing with a toolbar-panel param#3645
felipefreitag merged 1 commit into
canaryfrom
fix/toolbar-tab-navigation-static

Conversation

@felipefreitag

@felipefreitag felipefreitag commented Jul 10, 2026

Copy link
Copy Markdown
Member

On statically built previews (email-dev build + start), opening a preview URL that already carries a ?toolbar-panel=... query param left the toolbar tabs unresponsive: clicking any tab did nothing until a navigation succeeded from a clean URL first. The cause is that router.push with a query-only change silently no-ops in that state — the page was prerendered without search params, so the App Router has nothing to re-fetch for the same pathname. The dev server was unaffected.

The toolbar panel is purely client-side UI state, so this switches setActivePanelValue to shallow routing via window.history.pushState, which Next officially supports and keeps useSearchParams in sync. Besides fixing the static-build case, this drops the RSC round-trip and the scroll-to-top that router.push incurred on every tab switch.

Verified on a static demo build: landing on ?toolbar-panel=linter and switching tabs now updates the URL and panel, browser back/forward restores the previous tab, and the dev server behaves the same as before. Full @react-email/ui suite passes.

Related: surfaced while testing #3644, which makes the Props tab visible on static builds, but the bug reproduces on canary without it.


Summary by cubic

Fixes unresponsive toolbar tabs on statically built previews when the page loads with a ?toolbar-panel=... param. Switches tab changes to shallow routing via window.history.pushState, keeping useSearchParams in sync, preserving URL/back/forward, and avoiding an RSC round-trip and scroll-to-top.

Written for commit af859c2. Summary will update on new commits.

Review in cubic

On statically built previews, router.push with a query-only change
silently no-ops when the page was initially loaded with a query param
the prerender didn't include, leaving the toolbar tabs unresponsive.
The panel is client-side UI state, so use window.history.pushState
(Next's supported shallow routing, which keeps useSearchParams in
sync) instead of a router navigation. This also skips the RSC
round-trip and the scroll-to-top on every tab switch.
@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: af859c2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@react-email/ui Patch
react-email Patch
@react-email/editor Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
react-email Ready Ready Preview, Comment Jul 10, 2026 8:12pm
react-email-demo Ready Ready Preview, Comment Jul 10, 2026 8:12pm

@pkg-pr-new

pkg-pr-new Bot commented Jul 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@react-email/ui@3645

commit: af859c2

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Fixes static-build toolbar tab navigation by replacing router.push with window.history.pushState. Change is small, isolated, client-side only, and well-tested.

Re-trigger cubic

@felipefreitag
felipefreitag merged commit 7b32bf6 into canary Jul 10, 2026
19 of 20 checks passed
@felipefreitag
felipefreitag deleted the fix/toolbar-tab-navigation-static branch July 10, 2026 20:34
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