fix(studio): prevent route transition DOM duplication via AnimatePresence (#4987)

Add mode="wait" and exit={{ opacity: 0 }} to the root AnimatePresence
wrapper so outgoing routes fully unmount before incoming routes render.
Without this, rapid navigation between Studio/Export/Recipes/Chat caused
pages to stack (2x–3x duplication).

Co-authored-by: AdamPlatin123 <AdamPlatin123@users.noreply.github.com>
Co-authored-by: Wasim Yousef Said <wasimysdev@gmail.com>
This commit is contained in:
AdamPlatin123 2026-04-13 16:38:00 +08:00 committed by GitHub
parent 80c12ff1a6
commit 3b092bcd46
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -40,11 +40,12 @@ function RootLayout() {
return (
<AppProvider>
{!hideNavbar && <Navbar />}
<AnimatePresence initial={false}>
<AnimatePresence initial={false} mode="wait">
<motion.div
key={pathname}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.15 }}
className="flex-1"
>