-
Notifications
You must be signed in to change notification settings - Fork 27k
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
[EXPERIMENTAL] Route enter/exit transitions with Glue Component. #56591
base: canary
Are you sure you want to change the base?
[EXPERIMENTAL] Route enter/exit transitions with Glue Component. #56591
Conversation
PR also related to #49279 , a thread in which there's a (apparently now broken) hack that takes the userland approach of reading, freezing in a ref, and then re-providing the entire |
Still no updates on this? |
Taking this out of draft mode and fixing the merge conflicts to hopefully get some more visibility. Regardless of the current quirks with I'll just add that route transitions are super important, seen with a few of the other big frameworks:
We're kind of the odd one out. Would love some input from the Next.js team on thoughts / concerns. |
c056d8e
to
dbba963
Compare
So has this been approved? What's the latest update? |
Any update on this? really need this common feature on Next, which has been discussed for > 1 year |
Still has this same issue with the latest version, tried to bypass it by frozenroute, but some of the page failed loading, please help `"use client"; import { useContext, useRef, ReactNode } from "react"; export default function FrozenRoute(props: { children: React.ReactNode }) { return ( |
Just an update for everyone: I'm working on rebasing this PR to the latest I don't think Screen.Recording.2024-02-27.at.4.22.15.PM.movNotice how It's slow progress due to my lack of prior experience and understanding of the internals of RSCs and how server responses patch-update, but I think this PR will ultimately mean an additional change to Addendum I'm also curious how |
Why this ignored, can we finally fix exit transitions, please 🥲 |
This soon, please. it is kind of a must since there's almost no way to do this without freezing the router. Big upvote. |
c09840a
to
9df1d30
Compare
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
Discussion
#56594
What?
A persisted, opt-in, user-provided
glue
client component which slots between alayout
and atemplate
, actually receiving the keyed templates as a child, unlikelayout
. This allows enter and exit transitions likeframer-motion
provides:Screen.Recording.2023-10-08.at.3.05.00.PM.mov
See
examples/with-framer-motion-app-dir
in this branch for the app code for the above.EDIT: AnimatePresence does seem to break in this case when route transitions happen too quickly, i.e. you navigate elsewhere while a route is still transitioning out. In this case, nothing shows up (with "wait" mode) or both routes render together (with "sync" mode). I'm not sure why, haven't dug into the interaction between Next' router and
FramerMotion
yet. Waiting for exit to navigate does work consistently, at least.Why?
Route exit transitions are long overdue for Next.js 13's
appDir
. I think I speak for a lot of web designers and developers when I say this is a major factor preventing migration frompages/
toapp/
.How?
Closes NEXT-
Fixes #49596