Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENG-4659 feat(portal): set up hydration boundary in portal provider #888

Merged
merged 3 commits into from
Nov 7, 2024
Merged
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
25 changes: 20 additions & 5 deletions apps/portal/app/.client/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,20 @@ import { wagmiConfig } from '@lib/utils/wagmi'
import type { PrivyClientConfig } from '@privy-io/react-auth'
import { PrivyProvider } from '@privy-io/react-auth'
import { WagmiProvider } from '@privy-io/wagmi'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import {
HydrationBoundary,
QueryClient,
QueryClientProvider,
} from '@tanstack/react-query'

const queryClient = new QueryClient()
const queryClient = new QueryClient({
defaultOptions: {
queries: {
// Disable automatic refetching on window focus for SSR
refetchOnWindowFocus: false,
},
},
})

const privyConfig: PrivyClientConfig = {
embeddedWallets: {
Expand All @@ -22,9 +33,11 @@ const privyConfig: PrivyClientConfig = {
export default function Providers({
privyAppId,
children,
dehydratedState,
}: {
privyAppId: string
children: React.ReactNode
dehydratedState?: unknown
}) {
return (
<PrivyProvider
Expand All @@ -34,9 +47,11 @@ export default function Providers({
config={privyConfig}
>
<QueryClientProvider client={queryClient}>
<WagmiProvider config={wagmiConfig} reconnectOnMount={false}>
{children}
</WagmiProvider>
<HydrationBoundary state={dehydratedState}>
<WagmiProvider config={wagmiConfig} reconnectOnMount={false}>
{children}
</WagmiProvider>
</HydrationBoundary>
</QueryClientProvider>
</PrivyProvider>
)
Expand Down
Loading