From 9e5c4156856c91bfe1d12a76b9976e0e956aa05e Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Wed, 15 Jul 2026 18:10:56 +0000 Subject: [PATCH] =?UTF-8?q?Fix=20app=20switching=20=E2=80=94=20remount=20A?= =?UTF-8?q?ppFrame=20on=20slug=20change=20so=20iframe=20src=20recomputes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index b2b4eab..70663d7 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,4 @@ -import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom' +import { BrowserRouter, Routes, Route, Navigate, useParams } from 'react-router-dom' import { AuthGate } from './components/AuthGate' import { Login } from './pages/Login' import { Register } from './pages/Register' @@ -9,6 +9,13 @@ import { AdminRoles } from './pages/AdminRoles' import { AdminDepartments } from './pages/AdminDepartments' import { AdminMonitor } from './pages/AdminMonitor' import { AdminSettings } from './pages/AdminSettings' +import type { User } from './types' + +// Force full remount of AppFrame when slug changes so initialSrc recomputes +function AppFrameKeyed({ user }: { user: User }) { + const { slug } = useParams<{ slug: string }>() + return +} // The portal is only ever the top-level frame. If it finds itself loaded inside // an iframe, it means an app's path fell back to the portal (that app isn't @@ -46,7 +53,7 @@ export default function App() { {user => ( } /> - } /> + } /> : } /> : } /> : } />