From ed2b7476ae73dda7285c2d578ff1e1ac55a0a022 Mon Sep 17 00:00:00 2001 From: Gregor Vostrak Date: Mon, 16 Feb 2026 16:44:20 +0100 Subject: [PATCH] clear inertia cache on organization change to fix wrongly loaded stale pages --- resources/js/utils/useOrganization.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/js/utils/useOrganization.ts b/resources/js/utils/useOrganization.ts index 5751666f..ec5b18d5 100644 --- a/resources/js/utils/useOrganization.ts +++ b/resources/js/utils/useOrganization.ts @@ -12,6 +12,10 @@ import { getCurrentOrganizationId } from '@/utils/useUser'; import { api } from '@/packages/api/src'; export function switchOrganization(organizationId: string) { + // Clear Inertia's prefetch cache to prevent stale pages from the old + // organization being served when navigating after the switch. + router.flushAll(); + router.put( route('current-team.update'), {