Skip to content

Commit ed2b747

Browse files
committed
clear inertia cache on organization change to fix wrongly loaded stale pages
1 parent 8107c6a commit ed2b747

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

resources/js/utils/useOrganization.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import { getCurrentOrganizationId } from '@/utils/useUser';
1212
import { api } from '@/packages/api/src';
1313

1414
export function switchOrganization(organizationId: string) {
15+
// Clear Inertia's prefetch cache to prevent stale pages from the old
16+
// organization being served when navigating after the switch.
17+
router.flushAll();
18+
1519
router.put(
1620
route('current-team.update'),
1721
{

0 commit comments

Comments
 (0)