Skip to content

Fix ThemeProvider context mismatch in shadow-root modal providers#587

Open
bunnybones1 wants to merge 1 commit intomasterfrom
fix-theme-provider
Open

Fix ThemeProvider context mismatch in shadow-root modal providers#587
bunnybones1 wants to merge 1 commit intomasterfrom
fix-theme-provider

Conversation

@bunnybones1
Copy link
Contributor

Problem

Some integrations hit:

useTheme must be called within a ThemeProvider

while using @0xsequence/connect, @0xsequence/checkout, and @0xsequence/wallet-widget together.

Root cause

ShadowRoot (in @0xsequence/connect) always created ThemeProvider internally.
checkout and wallet-widget render design-system components in that shadow root. Depending on module resolution/install shape, this can cause a React context/module split and make useTheme resolve outside the expected provider instance.

Fix

  1. Added render-prop support to ShadowRoot so callers can receive the shadow container.
  2. Kept existing behavior for non-function children (backward compatible).
  3. Updated providers to mount their own ThemeProvider inside ShadowRoot using the passed container:
    • SequenceConnectProvider
    • SequenceConnectInlineProvider
    • SequenceCheckoutProvider
    • SequenceWalletProvider

Why this works

It removes the implicit cross-package provider coupling and ensures modal trees are wrapped by the provider instance associated with the package rendering those components.

Notes

  • This addresses the runtime theme-context error without requiring app-level @0xsequence/design-system setup.
  • Formatting checks pass on touched files.
  • Workspace typecheck currently has pre-existing monorepo resolution issues unrelated to this patch (@0xsequence/hooks / @0xsequence/connect module resolution).

@bunnybones1 bunnybones1 requested review from a team and 0xsequence-bot as code owners March 4, 2026 18:53
@cloudflare-workers-and-pages
Copy link

Deploying web-sdk-react-example with  Cloudflare Pages  Cloudflare Pages

Latest commit: 863b802
Status: ✅  Deploy successful!
Preview URL: https://95751280.web-sdk-react-example.pages.dev
Branch Preview URL: https://fix-theme-provider.web-sdk-react-example.pages.dev

View logs

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