frontend: nuke mmkv persisted cache + query cache on logout
Parents:
5f5ade61 file(s) changed
- frontend/context/AuthContext.tsx +5 -0
frontend/context/AuthContext.tsx
@@ -1,5 +1,6 @@
1 1 import React, { createContext, useContext, useEffect, useState } from 'react';
2 2 import { apiClient, User } from '@/lib/api';
3 + import { queryClient, storage } from '@/lib/queryClient';
3 4
4 5 interface AuthProviderProps {
5 6 children: React.ReactNode;
@@ -121,7 +122,11 @@ const logout = async () => {
121 122 setIsLoading(true);
122 123 try {
123 124 await apiClient.logout();
125 +
124 126 setUser(null);
127 + // Clear both the in-memory cache and the persisted MMKV cache
128 + queryClient.clear();
129 + storage.clearAll();
125 130 } finally {
126 131 setIsLoading(false);
127 132 }