Open
Description
Hey! Thanks again for opening up your ecosystem of tools, this was just what I was looking for - as proper page transitions in React / Next.js with lifecycle hooks are far from trivial :)
I'm currently trying to implement this using Next.js like this:
function DefaultPageTransition({ children }) {
const router = useRouter();
// get a more friendly path name (especially for generic pages instead of [...slug])
const pageName = router.asPath;
return (
<PageTransitions
key={router.isReady ? "hydrated" : "ssr"} // make sure ?querystring parsing works
pageName={pageName}
>
{children}
</PageTransitions>
);
}
<DefaultPageTransition>
<Component key={router.asPath} {...pageProps} />
</DefaultPageTransition>
I get this error however:
Error: This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition.
This happens in PageWrapper.tsx
, I've tried the following, but to no avail:
useEffect(() => {
startTransition(() => {
store.setState({ suspendedRoute: pathname });
});
return () => {
startTransition(() => {
store.setState({ suspendedRoute: null });
});
};
}, [pathname]);
I've also tried changing useEffect
to useIsoMorphicLayoutEffect
, but that won't help either.
Metadata
Metadata
Assignees
Labels
No labels