HydrationBoundary hydrates the global context client, so __RQ was re-serializing the same dehydrated state into every page's HTML (10-15KB per page, 149KB on /person) and then hydrating the same client again. The boundary is now the single serialization and hydration path.
30 lines
831 B
TypeScript
30 lines
831 B
TypeScript
'use client';
|
|
|
|
import { FC, ReactNode } from 'react';
|
|
import ModalContainer from 'react-modal-promise';
|
|
import { QueryClientProvider } from '@tanstack/react-query';
|
|
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
|
|
import { ThemeProvider } from 'next-themes';
|
|
|
|
import { Toaster } from '@/components/ui/toaster';
|
|
import getQueryClient from '@/lib/queryClient';
|
|
|
|
interface Props {
|
|
children: ReactNode;
|
|
}
|
|
|
|
const Providers: FC<Props> = ({ children }) => {
|
|
const queryClient = getQueryClient();
|
|
|
|
return (
|
|
<QueryClientProvider client={queryClient}>
|
|
<ThemeProvider attribute='data-mode'>{children}</ThemeProvider>
|
|
<ModalContainer exitTimeout={0} enterTimeout={0} />
|
|
<Toaster />
|
|
<ReactQueryDevtools initialIsOpen={false} />
|
|
</QueryClientProvider>
|
|
);
|
|
};
|
|
|
|
export default Providers;
|