We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c98968c commit eb3d700Copy full SHA for eb3d700
src/hydration/react.tsx
@@ -11,8 +11,9 @@ export function useHydrate(state: unknown, options?: HydrateOptions) {
11
12
// Running hydrate again with the same queries is safe,
13
// it wont overwrite or initialize existing queries,
14
- // relying on useEffect here is only a performance optimization
15
- React.useEffect(() => {
+ // relying on useMemo here is only a performance optimization.
+ // hydrate can and should be run *during* render here for SSR to work properly
16
+ React.useMemo(() => {
17
if (state) {
18
hydrate(queryClient, state, optionsRef.current)
19
}
0 commit comments