Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions pages/_app.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,6 @@ const BridgeModal = dynamic(() =>
import('src/components/transactions/Bridge/BridgeModal').then((module) => module.BridgeModal)
);

// ssr: false (unlike the other modal hosts) because `@funkit/connect` is a
// client-only, ESM/browser package.
const FunkitCheckout = dynamic(
() =>
import('src/components/transactions/FunCheckout/FunkitCheckout').then(
(module) => module.FunkitCheckout
),
{ ssr: false }
);

const BorrowModal = dynamic(() =>
import('src/components/transactions/Borrow/BorrowModal').then((module) => module.BorrowModal)
);
Expand All @@ -84,6 +74,17 @@ const RepayModal = dynamic(() =>
const SupplyModal = dynamic(() =>
import('src/components/transactions/Supply/SupplyModal').then((module) => module.SupplyModal)
);
// funkit checkout host, mounted once globally alongside the other modal hosts as an
// `ssr: false` island (`@funkit/connect` is client-only). Reuses the interface's
// wagmi + react-query. With `ssr: true` on the wagmi config the guest reconnect no
// longer churns, so a single global mount doesn't thrash — no page-scoping needed.
const FunkitCheckout = dynamic(
() =>
import('src/components/transactions/FunCheckout/FunkitCheckout').then(
(module) => module.FunkitCheckout
),
{ ssr: false }
);
const WithdrawModal = dynamic(() =>
import('src/components/transactions/Withdraw/WithdrawModal').then(
(module) => module.WithdrawModal
Expand Down Expand Up @@ -176,8 +177,8 @@ export default function MyApp(props: MyAppProps) {
<AppDataProvider>
<GasStationProvider>
{getLayout(<Component {...pageProps} />)}
<SupplyModal />
<FunkitCheckout />
<SupplyModal />
<WithdrawModal />
<BorrowModal />
<RepayModal />
Expand Down
5 changes: 5 additions & 0 deletions src/ui-config/wagmiConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ const connectors = narvalConnector ? [...(baseConnectors ?? []), narvalConnector
const prodConfig = createConfig({
...prodCkConfig,
connectors,
// Next.js SSR mode: run wagmi's reconnect once on mount (guarded) instead of
// on every render. Without this, WagmiProvider re-fires reconnect() on each
// render, ping-ponging account status and re-rendering the tree on navigation.
// Auto-reconnect for returning wallets is preserved.
ssr: true,
});

const isCypressEnabled = process.env.NEXT_PUBLIC_IS_CYPRESS_ENABLED === 'true';
Expand Down