Skip to content

Commit

Permalink
fix: frozen router workaround now implemented...
Browse files Browse the repository at this point in the history
  • Loading branch information
bl4ko committed Nov 8, 2024
1 parent 471607b commit 152d60e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/transitions/SlideShow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ import { AnimatePresence, motion } from "framer-motion";
import { usePathname } from "next/navigation";

// Unresolved issued, framer motion on exit don't work: https://github.com/vercel/next.js/issues/49279
// Workaround with frozen router: https://github.com/vercel/next.js/issues/49279#issuecomment-1718177583
// Workaround with frozen router: https://github.com/vercel/next.js/issues/49279#issuecomment-2461600967
import { LayoutRouterContext } from "next/dist/shared/lib/app-router-context.shared-runtime";

function FrozenRouter(props: { children: React.ReactNode }) {
const context = useContext(LayoutRouterContext);
const frozen = useRef(context).current;

if (!frozen) {
return <>{props.children}</>;
}

return (
<LayoutRouterContext.Provider value={frozen}>
{props.children}
Expand Down

0 comments on commit 152d60e

Please sign in to comment.