Skip to content

perf: lazy-load interactive Demo components on faucet page#256

Open
decofe wants to merge 3 commits intomainfrom
brendan/lazy-load-faucet-demo
Open

perf: lazy-load interactive Demo components on faucet page#256
decofe wants to merge 3 commits intomainfrom
brendan/lazy-load-faucet-demo

Conversation

@decofe
Copy link
Copy Markdown
Member

@decofe decofe commented Apr 8, 2026

Add a generic clientOnly() / clientOnlyNamed() helper (src/components/ClientOnly.tsx) that wraps React.lazy() + <Suspense> with a dashed-border placeholder. Use it across all pages with heavy interactive components so static MDX content paints immediately.

Pages updated

Page Lazy-loaded component
quickstart/faucet FaucetWalletDemo
guide/use-accounts/add-funds FaucetWalletDemo
quickstart/connection-details ConnectWallet
quickstart/integrate-tempo ConnectWallet
guide/use-accounts/connect-to-wallets ConnectWallet, ConnectToWalletsDemo
guide/use-accounts/embed-passkeys EmbedPasskeysDemo, EmbedPasskeys, SignInButtons
guide/use-accounts/embed-tempo-wallet AccountsSignInDemo, AccountsSignIn
accounts/index AccountsDemo
quickstart/tokenlist TokenListDemo

API

// default exports
const MyComponent = clientOnly(() => import('./MyComponent'), { minHeight: 200 })

// named exports
const MyComponent = clientOnlyNamed(() => import('./MyModule'), 'MyComponent', { minHeight: 200 })

Co-Authored-By: Brendan Ryan 1572504+brendanjryan@users.noreply.github.com

Prompted by: Brendan

Use React.lazy() + Suspense to dynamically import the heavy wagmi/viem
wallet UI so static MDX content (title, description, table) paints first.

Co-authored-by: Brendan Ryan <1572504+brendanjryan@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d6e1a-2a8e-7257-a027-d6c2cb562b8b
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 8, 2026

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

Project Deployment Actions Updated (UTC)
tempo-docs Ready Ready Preview, Comment Apr 8, 2026 6:00pm

Request Review

Co-Authored-By: Brendan Ryan <1572504+brendanjryan@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d6e1a-2a8e-7257-a027-d6c2cb562b8b
Replace faucet-specific LazyFaucetWalletDemo with a generic clientOnly()
helper that wraps React.lazy() + Suspense. Apply it to all pages with
heavy interactive components:

- faucet, add-funds: FaucetWalletDemo
- connection-details, integrate-tempo, connect-to-wallets: ConnectWallet
- embed-passkeys: EmbedPasskeys, SignInButtons
- embed-tempo-wallet: AccountsSignIn
- accounts: Demo + Steps
- tokenlist: TokenListDemo

Co-Authored-By: Brendan Ryan <1572504+brendanjryan@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d6e1a-2a8e-7257-a027-d6c2cb562b8b
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