I'm trying to create a wrapper over useNavigate which can help me have a page transition, but because of the async DOM update it is breaking #8633
Unanswered
jerrymedias
asked this question in
Q&A
Replies: 2 comments 5 replies
-
Can you provide a minimal code sandbox of what you're trying to achieve? |
Beta Was this translation helpful? Give feedback.
1 reply
-
@brophdawg11 Did you get a chance to have a look at the sandbox |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
To solve it I've kind of waited for a promise to get resolved within a setTimeout with a delay of 50ms. I know that navigate internally uses startTransition by default and we can pass unstable_flushSync as true in the options to have sync rendering instead of a concurrent rendering but that is not enabled of navigate(-1) or whenever delta is passed to it. Is this a correct solution or should I do something else. I also tried mutationObserver to observe the change in DOM and resolve the promise but that didn't work.
Also I need an answer that why only 50ms is working anything less than this is breaking the transition for a low end device
document.startViewTransition(async function updateDOMCallback() { delete options.skipTransition navigate(route, options) await new Promise((resolve) => { setTimeout(resolve, delay) }) })
@brophdawg11
Beta Was this translation helpful? Give feedback.
All reactions