Mobile Bug Fixes

This commit is contained in:
Eric gullickson
2025-09-22 20:31:27 -05:00
parent 3588372cef
commit 0f39e5eb7f
7 changed files with 86 additions and 495 deletions

View File

@@ -23,6 +23,8 @@ export const useVehicles = () => {
queryKey: ['vehicles'],
queryFn: vehiclesApi.getAll,
enabled: isAuthenticated && !isLoading,
staleTime: 5 * 60 * 1000, // 5 minutes - prevent unnecessary refetches
gcTime: 10 * 60 * 1000, // 10 minutes cache time
retry: (failureCount, error: any) => {
// Retry 401 errors up to 3 times for mobile auth timing issues
if (error?.response?.status === 401 && failureCount < 3) {
@@ -32,6 +34,8 @@ export const useVehicles = () => {
return false;
},
retryDelay: (attemptIndex) => Math.min(1000 * 2 ** attemptIndex, 30000),
refetchOnWindowFocus: false, // Prevent refetch on window focus
refetchOnMount: false, // Only fetch on mount if data is stale
});
};