Skip to content

fix: wrap page tree in BannerStateProvider (unbreaks @myst-theme 1.x rendering)#61

Merged
mmcky merged 2 commits into
mainfrom
fix/banner-state-provider
Jun 4, 2026
Merged

fix: wrap page tree in BannerStateProvider (unbreaks @myst-theme 1.x rendering)#61
mmcky merged 2 commits into
mainfrom
fix/banner-state-provider

Conversation

@mmcky
Copy link
Copy Markdown
Contributor

@mmcky mmcky commented Jun 4, 2026

2.0.0 deploy blocker. @myst-theme 1.x moved banner visibility/height into a React context (BannerStateProvider); a child component calls useBannerState() during SSR. Our custom app/components/Page.tsx provider stack didn't include it, so every page threw useBannerState must be used from within BannerStateProvider → HTTP 500.

Why it slipped through:

Fix

Wrap the page tree in BannerStateProvider (from @myst-theme/providers), mirroring upstream's page route.

Validation (via the visual harness, #60)

before after
/, /features, /notebook 500 200
notebook stream/error outputs (crash) render ✓
diff vs v1.1.1 baselines modest 2–4% of pixels (expected 0.14→1.3.0 styling)

This unblocks the 2.0.0 cut. Recommend landing #60 (harness) and this together; after 2.0.0 is accepted, re-baseline the snapshots to 2.0.0.

🤖 Generated with Claude Code

@myst-theme 1.x moved banner visibility/height into a React context
(`BannerStateProvider` in @myst-theme/providers); a child component calls
`useBannerState()` during SSR. Our custom app/components/Page.tsx provider
stack didn't include the provider, so every page threw
"useBannerState must be used from within BannerStateProvider" and returned
HTTP 500. `compile` + `prod:build` pass (it's a runtime/SSR error), and it had
never surfaced because the deployed bundle is still v1.1.1 (@myst-theme 0.14) —
the 1.x upgrade had never actually rendered.

Wrap the tree in BannerStateProvider, mirroring upstream's page route.

Found + validated with the new visual-regression harness (#60): all pages go
500 -> 200, notebook stream/error outputs render, and the diff vs the v1.1.1
baselines is a modest 2-4% (expected styling from the 0.14->1.3.0 upgrade).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 4, 2026 05:19
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses an SSR runtime crash introduced by upgrading to @myst-theme 1.x, where some layout code calls useBannerState() and now requires a BannerStateProvider to be present in the React provider stack.

Changes:

  • Import BannerStateProvider from @myst-theme/providers.
  • Wrap the main page render tree in BannerStateProvider to prevent useBannerState must be used from within BannerStateProvider SSR failures.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/components/Page.tsx Outdated
…pper

Addresses Copilot review: the provider was only on the happy path (Page),
but ErrorBoundary -> ErrorPage also renders NavigationAndArticleWrapper,
whose useSidebarHeight -> useBannerState would still 500 the error UI.

Place BannerStateProvider inside NavigationAndArticleWrapper (used by both
Page and ErrorPage) and drop the now-redundant wrap in Page.tsx, so every
tree that renders the wrapper has the provider.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mmcky mmcky merged commit 11e0446 into main Jun 4, 2026
1 check passed
@mmcky mmcky deleted the fix/banner-state-provider branch June 4, 2026 06:03
mmcky added a commit that referenced this pull request Jun 4, 2026
Bump 1.1.1 -> 2.0.0 across package.json, package-lock.json and
template.yml, and finalize the CHANGELOG [2.0.0] section.

2.0.0 is the @myst-theme 0.14 -> 1.x upgrade (breaking: new notebook
output-node AST; Node engine >=20) plus the technical-review pass, the
visual-regression harness (#60), and three pre-release fixes for
regressions the 1.x upgrade introduced and caught before deploy: the
BannerStateProvider 500 (#61), the full-bleed content column (#62), and
the Remix 1.19 hydration reload loop (#63).

CHANGELOG corrections vs the old [Unreleased] draft: drop the reverted
#29 Remix 1.17->1.19 bump (2.0.0 stays on the v1.0.1 ~1.17.0 pin, so no
net Remix change), correct the Node floor to >=20, and restate the
Security note now that the older Remix v1 toolchain remains.

Co-authored-by: Claude Opus 4.8 <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.

2 participants