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'), {