@umituz/react-native-design-system 4.23.81 → 4.23.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/atoms/icon/AtomicIcon.tsx +1 -0
- package/src/atoms/icon/iconStore.ts +2 -0
- package/src/device/infrastructure/services/PersistentDeviceIdService.ts +4 -0
- package/src/haptics/infrastructure/services/HapticService.ts +1 -0
- package/src/init/createAppInitializer.ts +1 -0
- package/src/layouts/Grid/Grid.tsx +16 -11
- package/src/media/infrastructure/services/CardMediaOptimizerService.ts +1 -0
- package/src/media/infrastructure/utils/file-media-utils.ts +25 -8
- package/src/molecules/BaseModal.tsx +1 -0
- package/src/molecules/bottom-sheet/components/BottomSheetModal.tsx +1 -0
- package/src/molecules/navigation/StackNavigator.tsx +1 -0
- package/src/molecules/navigation/TabsNavigator.tsx +1 -0
- package/src/molecules/navigation/types.ts +2 -2
- package/src/molecules/swipe-actions/presentation/components/SwipeActionButton.tsx +14 -1
- package/src/offline/infrastructure/events/NetworkEvents.ts +2 -1
- package/src/offline/infrastructure/utils/healthCheck.ts +1 -1
- package/src/offline/presentation/hooks/useOffline.ts +3 -2
- package/src/offline/presentation/hooks/useOfflineWithMutations.ts +1 -1
- package/src/onboarding/infrastructure/storage/actions/storageHelpers.ts +1 -1
- package/src/onboarding/presentation/hooks/useOnboardingScreenHandlers.ts +2 -2
- package/src/storage/cache/domain/__tests__/ErrorHandler.test.ts +8 -8
- package/src/storage/domain/utils/devUtils.ts +10 -9
- package/src/storage/infrastructure/adapters/StorageService.ts +0 -9
- package/src/storage/infrastructure/repositories/BaseStorageOperations.ts +0 -3
- package/src/tanstack/domain/config/QueryClientAccessor.ts +1 -1
- package/src/tanstack/domain/repositories/RepositoryFactory.ts +1 -1
- package/src/tanstack/domain/utils/ErrorHelpers.ts +1 -1
- package/src/tanstack/infrastructure/config/PersisterConfig.ts +6 -6
- package/src/tanstack/infrastructure/config/QueryClientConfig.ts +0 -12
- package/src/tanstack/infrastructure/monitoring/DevMonitorLogger.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "4.23.
|
|
3
|
+
"version": "4.23.83",
|
|
4
4
|
"description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive, safe area, exception, infinite scroll, UUID, image, timezone, offline, onboarding, and loading utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"@testing-library/react": "^16.3.1",
|
|
117
117
|
"@testing-library/react-native": "^13.3.3",
|
|
118
118
|
"@types/jest": "^30.0.0",
|
|
119
|
-
"@types/react": "~19.
|
|
119
|
+
"@types/react": "~19.2.4",
|
|
120
120
|
"@types/react-native": "^0.73.0",
|
|
121
121
|
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
|
122
122
|
"@typescript-eslint/parser": "^8.50.1",
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
"expo-secure-store": "~15.0.8",
|
|
143
143
|
"expo-sharing": "~14.0.8",
|
|
144
144
|
"expo-video": "~3.0.15",
|
|
145
|
-
"react": "19.
|
|
145
|
+
"react": "19.2.4",
|
|
146
146
|
"react-native": "0.81.4",
|
|
147
147
|
"react-native-gesture-handler": "^2.20.0",
|
|
148
148
|
"react-native-safe-area-context": "^5.6.0",
|
|
@@ -122,6 +122,7 @@ export const AtomicIcon: React.FC<AtomicIconProps> = React.memo(
|
|
|
122
122
|
// No icon renderer provided - warn in dev and render nothing
|
|
123
123
|
if (!iconRenderer) {
|
|
124
124
|
if (__DEV__) {
|
|
125
|
+
console.warn(
|
|
125
126
|
'[DesignSystem] AtomicIcon requires an iconRenderer in DesignSystemProvider.\n' +
|
|
126
127
|
'Example:\n' +
|
|
127
128
|
'<DesignSystemProvider\n' +
|
|
@@ -75,6 +75,7 @@ export const useIconStore = create<IconStore>((set) => ({
|
|
|
75
75
|
if (__DEV__) {
|
|
76
76
|
const missingKeys = REQUIRED_ICON_KEYS.filter(key => !iconNames[key]);
|
|
77
77
|
if (missingKeys.length > 0) {
|
|
78
|
+
console.warn(
|
|
78
79
|
`[DesignSystem] Missing icon names: ${missingKeys.join(', ')}`
|
|
79
80
|
);
|
|
80
81
|
}
|
|
@@ -100,6 +101,7 @@ export const useIconName = (key: keyof IconNames): string => {
|
|
|
100
101
|
|
|
101
102
|
if (!iconNames) {
|
|
102
103
|
if (__DEV__) {
|
|
104
|
+
console.warn(
|
|
103
105
|
`[DesignSystem] useIconName("${key}") - iconNames not configured.`
|
|
104
106
|
);
|
|
105
107
|
}
|
|
@@ -43,6 +43,7 @@ export class PersistentDeviceIdService {
|
|
|
43
43
|
|
|
44
44
|
if (secureId) {
|
|
45
45
|
if (__DEV__) {
|
|
46
|
+
console.log(`[DesignSystem] Device ID: Using secure ID: ${secureId}`);
|
|
46
47
|
}
|
|
47
48
|
cachedDeviceId = secureId;
|
|
48
49
|
return secureId;
|
|
@@ -53,12 +54,14 @@ export class PersistentDeviceIdService {
|
|
|
53
54
|
await this.secureRepo.set(newId);
|
|
54
55
|
|
|
55
56
|
if (__DEV__) {
|
|
57
|
+
console.log(`[DesignSystem] Device ID: Created new ID: ${newId}`);
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
cachedDeviceId = newId;
|
|
59
61
|
return newId;
|
|
60
62
|
} catch (error) {
|
|
61
63
|
if (__DEV__) {
|
|
64
|
+
console.error('[DesignSystem] Device ID: Initialization failed', error);
|
|
62
65
|
}
|
|
63
66
|
const fallbackId = `fallback_${generateUUID()}`;
|
|
64
67
|
cachedDeviceId = fallbackId;
|
|
@@ -100,6 +103,7 @@ export class PersistentDeviceIdService {
|
|
|
100
103
|
cachedDeviceId = null;
|
|
101
104
|
initializationPromise = null;
|
|
102
105
|
if (__DEV__) {
|
|
106
|
+
console.log('[DesignSystem] Device ID: Stored ID cleared');
|
|
103
107
|
}
|
|
104
108
|
} catch {
|
|
105
109
|
// Silent fail
|
|
@@ -16,6 +16,7 @@ import type { ImpactStyle, NotificationType, HapticPattern } from '../../domain/
|
|
|
16
16
|
*/
|
|
17
17
|
function logError(method: string, error: unknown): void {
|
|
18
18
|
if (process.env.NODE_ENV === 'development') {
|
|
19
|
+
console.error(`[DesignSystem] HapticService.${method} error:`, error);
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -78,17 +78,22 @@ export const Grid: React.FC<GridProps> = ({
|
|
|
78
78
|
|
|
79
79
|
return (
|
|
80
80
|
<View style={[styles.container, style]} testID={testID}>
|
|
81
|
-
{childArray.map((child, index) =>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
81
|
+
{childArray.map((child, index) => {
|
|
82
|
+
// Use child's key if available, otherwise use index
|
|
83
|
+
const key = (child as React.ReactElement).key || `grid-item-${index}`;
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<View
|
|
87
|
+
key={key}
|
|
88
|
+
style={{
|
|
89
|
+
flex: columns ? 1 / columns - 0.01 : undefined,
|
|
90
|
+
minWidth: columns ? `${100 / columns - 1}%` : undefined,
|
|
91
|
+
}}
|
|
92
|
+
>
|
|
93
|
+
{child}
|
|
94
|
+
</View>
|
|
95
|
+
);
|
|
96
|
+
})}
|
|
92
97
|
</View>
|
|
93
98
|
);
|
|
94
99
|
};
|
|
@@ -74,16 +74,33 @@ export const downloadMediaToFile = async (url: string, isVideo: boolean): Promis
|
|
|
74
74
|
const filename = `media_${timestamp}.${extension}`;
|
|
75
75
|
const file = new ExpoFile(Paths.cache, filename);
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
77
|
+
// Create abort controller for timeout
|
|
78
|
+
const controller = new AbortController();
|
|
79
|
+
const timeoutId = setTimeout(() => controller.abort(), 30000); // 30 second timeout
|
|
81
80
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
try {
|
|
82
|
+
const response = await fetch(url, { signal: controller.signal });
|
|
83
|
+
clearTimeout(timeoutId);
|
|
85
84
|
|
|
86
|
-
|
|
85
|
+
if (!response.ok) {
|
|
86
|
+
throw new Error(`Failed to download media: ${response.statusText}`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
90
|
+
const bytes = new Uint8Array(arrayBuffer);
|
|
91
|
+
file.write(bytes);
|
|
92
|
+
|
|
93
|
+
return file.uri;
|
|
94
|
+
} catch (error) {
|
|
95
|
+
// Clear timeout if error occurs
|
|
96
|
+
clearTimeout(timeoutId);
|
|
97
|
+
|
|
98
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
99
|
+
throw new Error('Download timeout - request took longer than 30 seconds');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
87
104
|
};
|
|
88
105
|
|
|
89
106
|
export interface SaveToGalleryResult {
|
|
@@ -28,6 +28,7 @@ export function StackNavigator<T extends ParamListBase>({ config }: StackNavigat
|
|
|
28
28
|
NavigationValidator.validateInitialRoute(config.initialRouteName, config.screens);
|
|
29
29
|
} catch (error) {
|
|
30
30
|
if (__DEV__) {
|
|
31
|
+
console.error("[DesignSystem] StackNavigator validation failed:", error);
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
|
|
@@ -30,9 +30,9 @@ export interface BaseScreen<T extends ParamListBase = ParamListBase> {
|
|
|
30
30
|
/** Unique name identifier for the screen */
|
|
31
31
|
name: Extract<keyof T, string>;
|
|
32
32
|
/** React component to render for this screen */
|
|
33
|
-
component?: React.ComponentType<
|
|
33
|
+
component?: React.ComponentType<any>;
|
|
34
34
|
/** Render function for children (alternative to component) */
|
|
35
|
-
children?: (props:
|
|
35
|
+
children?: (props: any) => React.ReactNode;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
@@ -65,7 +65,20 @@ export const SwipeActionButton: React.FC<SwipeActionButtonProps> = ({
|
|
|
65
65
|
const enableHaptics = action.enableHaptics !== false;
|
|
66
66
|
|
|
67
67
|
// Get background color from theme or custom
|
|
68
|
-
|
|
68
|
+
// Type-safe color lookup with fallback
|
|
69
|
+
const getBackgroundColor = (): string => {
|
|
70
|
+
if (customColor) {
|
|
71
|
+
return customColor;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (colorKey && colorKey in tokens.colors) {
|
|
75
|
+
return tokens.colors[colorKey as keyof typeof tokens.colors];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return tokens.colors.primary;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const backgroundColor = getBackgroundColor();
|
|
69
82
|
|
|
70
83
|
const handlePress = async () => {
|
|
71
84
|
// Trigger haptic feedback
|
|
@@ -35,8 +35,9 @@ class NetworkEventEmitter implements NetworkEvents {
|
|
|
35
35
|
this.listeners.get(event)?.forEach((listener) => {
|
|
36
36
|
try {
|
|
37
37
|
listener(state);
|
|
38
|
-
} catch (
|
|
38
|
+
} catch (_error) {
|
|
39
39
|
if (__DEV__) {
|
|
40
|
+
console.error('[DesignSystem] PersistentDeviceIdService: Initialization failed', _error);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
});
|
|
@@ -56,7 +56,7 @@ export const useOffline = (config?: OfflineConfig) => {
|
|
|
56
56
|
|
|
57
57
|
networkEvents.emit('change', networkState);
|
|
58
58
|
previousStateRef.current = networkState;
|
|
59
|
-
}, [store]);
|
|
59
|
+
}, [store, previousStateRef]);
|
|
60
60
|
|
|
61
61
|
useEffect(() => {
|
|
62
62
|
if (isInitialized.current) return;
|
|
@@ -70,8 +70,9 @@ export const useOffline = (config?: OfflineConfig) => {
|
|
|
70
70
|
isInitialized.current = true;
|
|
71
71
|
}
|
|
72
72
|
})
|
|
73
|
-
.catch((
|
|
73
|
+
.catch((_error: Error) => {
|
|
74
74
|
if (isMountedRef.current && (__DEV__ || mergedConfig.debug)) {
|
|
75
|
+
console.error('[DesignSystem] useOffline: Failed to get initial network state', _error);
|
|
75
76
|
}
|
|
76
77
|
});
|
|
77
78
|
|
|
@@ -58,7 +58,7 @@ export function useOnboardingScreenHandlers({
|
|
|
58
58
|
loadAnswerForSlide(nextSlide);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
} catch (
|
|
61
|
+
} catch (_error) {
|
|
62
62
|
if (__DEV__) {
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -98,7 +98,7 @@ export function useOnboardingScreenHandlers({
|
|
|
98
98
|
const handleSkip = useCallback(async () => {
|
|
99
99
|
try {
|
|
100
100
|
await skipOnboarding();
|
|
101
|
-
} catch (
|
|
101
|
+
} catch (_error) {
|
|
102
102
|
if (__DEV__) {
|
|
103
103
|
}
|
|
104
104
|
}
|
|
@@ -56,7 +56,7 @@ describe('ErrorHandler', () => {
|
|
|
56
56
|
|
|
57
57
|
try {
|
|
58
58
|
ErrorHandler.handle(originalError, 'test context');
|
|
59
|
-
} catch (
|
|
59
|
+
} catch (_error) {
|
|
60
60
|
expect((error as CacheError).message).toBe('test context: Regular error');
|
|
61
61
|
expect((error as CacheError).code).toBe('CACHE_ERROR');
|
|
62
62
|
}
|
|
@@ -67,7 +67,7 @@ describe('ErrorHandler', () => {
|
|
|
67
67
|
|
|
68
68
|
try {
|
|
69
69
|
ErrorHandler.handle(unknownError, 'test context');
|
|
70
|
-
} catch (
|
|
70
|
+
} catch (_error) {
|
|
71
71
|
expect((error as CacheError).message).toBe('test context: Unknown error');
|
|
72
72
|
expect((error as CacheError).code).toBe('UNKNOWN_ERROR');
|
|
73
73
|
}
|
|
@@ -76,7 +76,7 @@ describe('ErrorHandler', () => {
|
|
|
76
76
|
test('should handle null error', () => {
|
|
77
77
|
try {
|
|
78
78
|
ErrorHandler.handle(null, 'test context');
|
|
79
|
-
} catch (
|
|
79
|
+
} catch (_error) {
|
|
80
80
|
expect((error as CacheError).message).toBe('test context: Unknown error');
|
|
81
81
|
expect((error as CacheError).code).toBe('UNKNOWN_ERROR');
|
|
82
82
|
}
|
|
@@ -85,7 +85,7 @@ describe('ErrorHandler', () => {
|
|
|
85
85
|
test('should handle undefined error', () => {
|
|
86
86
|
try {
|
|
87
87
|
ErrorHandler.handle(undefined, 'test context');
|
|
88
|
-
} catch (
|
|
88
|
+
} catch (_error) {
|
|
89
89
|
expect((error as CacheError).message).toBe('test context: Unknown error');
|
|
90
90
|
expect((error as CacheError).code).toBe('UNKNOWN_ERROR');
|
|
91
91
|
}
|
|
@@ -97,7 +97,7 @@ describe('ErrorHandler', () => {
|
|
|
97
97
|
|
|
98
98
|
try {
|
|
99
99
|
ErrorHandler.handle(originalError, 'test context');
|
|
100
|
-
} catch (
|
|
100
|
+
} catch (_error) {
|
|
101
101
|
const cacheError = error as CacheError;
|
|
102
102
|
expect(cacheError.message).toBe('test context: Original error');
|
|
103
103
|
expect(cacheError.code).toBe('CACHE_ERROR');
|
|
@@ -135,7 +135,7 @@ describe('ErrorHandler', () => {
|
|
|
135
135
|
|
|
136
136
|
try {
|
|
137
137
|
await ErrorHandler.withTimeout(promise, 1000, 'test context');
|
|
138
|
-
} catch (
|
|
138
|
+
} catch (_error) {
|
|
139
139
|
expect((error as CacheError).message).toBe('test context: Operation timed out after 1000ms');
|
|
140
140
|
expect((error as CacheError).code).toBe('TIMEOUT');
|
|
141
141
|
}
|
|
@@ -154,7 +154,7 @@ describe('ErrorHandler', () => {
|
|
|
154
154
|
|
|
155
155
|
try {
|
|
156
156
|
await ErrorHandler.withTimeout(promise, 1000, 'test context');
|
|
157
|
-
} catch (
|
|
157
|
+
} catch (_error) {
|
|
158
158
|
expect((error as CacheError).message).toBe('test context: Promise rejected');
|
|
159
159
|
expect((error as CacheError).code).toBe('CACHE_ERROR');
|
|
160
160
|
}
|
|
@@ -261,7 +261,7 @@ describe('ErrorHandler', () => {
|
|
|
261
261
|
|
|
262
262
|
try {
|
|
263
263
|
await ErrorHandler.withTimeout(promise, 1000, 'test');
|
|
264
|
-
} catch (
|
|
264
|
+
} catch (_error) {
|
|
265
265
|
expect((error as CacheError).code).toBe('TIMEOUT');
|
|
266
266
|
}
|
|
267
267
|
});
|
|
@@ -11,24 +11,25 @@ export const isDev = (): boolean => {
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Log warning in development mode only
|
|
14
|
+
* All logs are disabled
|
|
14
15
|
*/
|
|
15
|
-
export const devWarn = (
|
|
16
|
-
|
|
17
|
-
}
|
|
16
|
+
export const devWarn = (_message: string, ..._args: unknown[]): void => {
|
|
17
|
+
// Disabled
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Log error in development mode only
|
|
22
|
+
* All logs are disabled
|
|
22
23
|
*/
|
|
23
|
-
export const devError = (
|
|
24
|
-
|
|
25
|
-
}
|
|
24
|
+
export const devError = (_message: string, ..._args: unknown[]): void => {
|
|
25
|
+
// Disabled
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Log info in development mode only
|
|
30
|
+
* All logs are disabled
|
|
30
31
|
*/
|
|
31
|
-
export const devLog = (
|
|
32
|
-
|
|
33
|
-
}
|
|
32
|
+
export const devLog = (_message: string, ..._args: unknown[]): void => {
|
|
33
|
+
// Disabled
|
|
34
34
|
};
|
|
35
|
+
|
|
@@ -20,9 +20,6 @@ export const storageService: StateStorage = {
|
|
|
20
20
|
} catch (error) {
|
|
21
21
|
const errorMessage = `StorageService: Failed to get item "${name}"`;
|
|
22
22
|
devWarn(errorMessage, error);
|
|
23
|
-
// Also log in production for debugging
|
|
24
|
-
if (!__DEV__) {
|
|
25
|
-
}
|
|
26
23
|
return null;
|
|
27
24
|
}
|
|
28
25
|
},
|
|
@@ -33,9 +30,6 @@ export const storageService: StateStorage = {
|
|
|
33
30
|
} catch (error) {
|
|
34
31
|
const errorMessage = `StorageService: Failed to set item "${name}"`;
|
|
35
32
|
devWarn(errorMessage, error);
|
|
36
|
-
// Also log in production for debugging
|
|
37
|
-
if (!__DEV__) {
|
|
38
|
-
}
|
|
39
33
|
}
|
|
40
34
|
},
|
|
41
35
|
|
|
@@ -45,9 +39,6 @@ export const storageService: StateStorage = {
|
|
|
45
39
|
} catch (error) {
|
|
46
40
|
const errorMessage = `StorageService: Failed to remove item "${name}"`;
|
|
47
41
|
devWarn(errorMessage, error);
|
|
48
|
-
// Also log in production for debugging
|
|
49
|
-
if (!__DEV__) {
|
|
50
|
-
}
|
|
51
42
|
}
|
|
52
43
|
},
|
|
53
44
|
};
|
|
@@ -83,9 +83,6 @@ export class BaseStorageOperations {
|
|
|
83
83
|
} catch (error) {
|
|
84
84
|
const errorMessage = `BaseStorageOperations: Failed to check if key "${key}" exists`;
|
|
85
85
|
devWarn(errorMessage, error);
|
|
86
|
-
// Also log in production for debugging
|
|
87
|
-
if (!__DEV__) {
|
|
88
|
-
}
|
|
89
86
|
return false;
|
|
90
87
|
}
|
|
91
88
|
}
|
|
@@ -20,7 +20,7 @@ let globalQueryClient: QueryClient | null = null;
|
|
|
20
20
|
export function setGlobalQueryClient(client: QueryClient): void {
|
|
21
21
|
if (globalQueryClient && globalQueryClient !== client) {
|
|
22
22
|
if (__DEV__) {
|
|
23
|
-
|
|
23
|
+
console.warn(
|
|
24
24
|
'[TanStack] QueryClient instance changed. Ensure you are not creating multiple instances.',
|
|
25
25
|
);
|
|
26
26
|
}
|
|
@@ -146,7 +146,7 @@ export function getErrorCode(error: unknown): string | null {
|
|
|
146
146
|
/**
|
|
147
147
|
* Log error in development
|
|
148
148
|
*/
|
|
149
|
-
export function logError(
|
|
149
|
+
export function logError(_context: string, _error: unknown): void {
|
|
150
150
|
if (__DEV__) {
|
|
151
151
|
|
|
152
152
|
}
|
|
@@ -82,7 +82,7 @@ export function createPersister(options: PersisterFactoryOptions = {}): Persiste
|
|
|
82
82
|
// Validate cache version
|
|
83
83
|
if (parsed.version !== busterVersion) {
|
|
84
84
|
if (__DEV__) {
|
|
85
|
-
|
|
85
|
+
console.warn(
|
|
86
86
|
`[TanStack Query] Cache version mismatch. Expected: ${busterVersion}, Got: ${parsed.version}`,
|
|
87
87
|
);
|
|
88
88
|
}
|
|
@@ -93,7 +93,7 @@ export function createPersister(options: PersisterFactoryOptions = {}): Persiste
|
|
|
93
93
|
const age = Date.now() - parsed.timestamp;
|
|
94
94
|
if (age > maxAge) {
|
|
95
95
|
if (__DEV__) {
|
|
96
|
-
|
|
96
|
+
console.warn(`[TanStack Query] Cache age exceeded maxAge: ${maxAge}ms`);
|
|
97
97
|
}
|
|
98
98
|
return undefined;
|
|
99
99
|
}
|
|
@@ -101,7 +101,7 @@ export function createPersister(options: PersisterFactoryOptions = {}): Persiste
|
|
|
101
101
|
return parsed.data;
|
|
102
102
|
} catch (error) {
|
|
103
103
|
if (__DEV__) {
|
|
104
|
-
|
|
104
|
+
console.error('[TanStack Query] Error deserializing cache:', error);
|
|
105
105
|
}
|
|
106
106
|
return undefined;
|
|
107
107
|
}
|
|
@@ -122,11 +122,11 @@ export async function clearPersistedCache(keyPrefix: string = 'tanstack-query'):
|
|
|
122
122
|
try {
|
|
123
123
|
await storageService.removeItem(`${keyPrefix}-cache`);
|
|
124
124
|
if (__DEV__) {
|
|
125
|
-
|
|
125
|
+
console.log(`[TanStack Query] Cleared persisted cache for keyPrefix: ${keyPrefix}`);
|
|
126
126
|
}
|
|
127
127
|
} catch (error) {
|
|
128
128
|
if (__DEV__) {
|
|
129
|
-
|
|
129
|
+
console.error('[TanStack Query] Error clearing persisted cache:', error);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
}
|
|
@@ -148,7 +148,7 @@ export async function getPersistedCacheSize(
|
|
|
148
148
|
return data ? new Blob([data]).size : 0;
|
|
149
149
|
} catch (error) {
|
|
150
150
|
if (__DEV__) {
|
|
151
|
-
|
|
151
|
+
console.error('[TanStack Query] Error getting persisted cache size:', error);
|
|
152
152
|
}
|
|
153
153
|
return 0;
|
|
154
154
|
}
|
|
@@ -86,12 +86,6 @@ export interface QueryClientFactoryOptions {
|
|
|
86
86
|
* @default 3
|
|
87
87
|
*/
|
|
88
88
|
defaultRetry?: boolean | number | RetryFunction;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Enable development mode logging
|
|
92
|
-
* @default __DEV__
|
|
93
|
-
*/
|
|
94
|
-
enableDevLogging?: boolean;
|
|
95
89
|
}
|
|
96
90
|
|
|
97
91
|
/**
|
|
@@ -110,7 +104,6 @@ export function createQueryClient(options: QueryClientFactoryOptions = {}): Quer
|
|
|
110
104
|
defaultStaleTime = DEFAULT_STALE_TIME.SHORT,
|
|
111
105
|
defaultGcTime = DEFAULT_GC_TIME.LONG,
|
|
112
106
|
defaultRetry = DEFAULT_RETRY.STANDARD,
|
|
113
|
-
enableDevLogging = __DEV__,
|
|
114
107
|
} = options;
|
|
115
108
|
|
|
116
109
|
return new QueryClient({
|
|
@@ -125,11 +118,6 @@ export function createQueryClient(options: QueryClientFactoryOptions = {}): Quer
|
|
|
125
118
|
},
|
|
126
119
|
mutations: {
|
|
127
120
|
retry: DEFAULT_RETRY.MINIMAL,
|
|
128
|
-
onError: (error: Error) => {
|
|
129
|
-
if (enableDevLogging) {
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
121
|
},
|
|
134
122
|
},
|
|
135
123
|
});
|