fix: resolve HashRouter reload issues during impersonation handoffs
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m2s
All checks were successful
Build and Deploy / build-and-push (push) Successful in 1m2s
- Updated Layout and SuperAdmin to explicitly set window.location.hash before triggering window.location.reload() to guarantee correct routing after state resets.
This commit is contained in:
@@ -217,7 +217,8 @@ export const Layout: React.FC<{ children: React.ReactNode }> = ({ children }) =>
|
||||
<button
|
||||
onClick={() => {
|
||||
if (returnToSuperAdmin()) {
|
||||
window.location.href = '/#/super-admin';
|
||||
window.location.hash = '#/super-admin';
|
||||
window.location.reload();
|
||||
}
|
||||
}}
|
||||
className="w-full flex items-center justify-center gap-2 py-2 px-3 bg-zinc-900 dark:bg-brand-yellow text-white dark:text-zinc-950 rounded-lg text-xs font-bold hover:opacity-90 transition-colors"
|
||||
|
||||
@@ -101,7 +101,8 @@ export const SuperAdmin: React.FC = () => {
|
||||
}
|
||||
await impersonateTenant(tenantId);
|
||||
// Force a full reload to clear any cached context/state in the React app
|
||||
window.location.href = '/';
|
||||
window.location.hash = '#/';
|
||||
window.location.reload();
|
||||
} catch (err: any) {
|
||||
alert(err.message || 'Erro ao tentar entrar na organização.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user