@umituz/react-native-design-system 4.25.112 → 4.25.113

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@umituz/react-native-design-system",
3
- "version": "4.25.112",
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",
3
+ "version": "4.25.113",
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 - TanStack persistence now lazy loaded",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./dist/index.d.ts",
7
7
  "sideEffects": false,
@@ -172,6 +172,10 @@
172
172
  "react-native-svg": "^15.12.1",
173
173
  "rn-emoji-keyboard": "^1.7.0"
174
174
  },
175
+ "optionalDependencies": {
176
+ "@tanstack/query-async-storage-persister": "^5.0.0",
177
+ "@tanstack/react-query-persist-client": "^5.0.0"
178
+ },
175
179
  "keywords": [
176
180
  "react-native",
177
181
  "design-system",
@@ -3,12 +3,11 @@
3
3
  * Infrastructure layer - AsyncStorage persistence setup
4
4
  *
5
5
  * General-purpose persistence configuration for any React Native app
6
+ * Lazy loads TanStack persistence packages to reduce bundle size
6
7
  */
7
8
 
8
- import { createAsyncStoragePersister } from '@tanstack/query-async-storage-persister';
9
9
  import { storageService } from '../../../storage';
10
10
  import { DEFAULT_GC_TIME } from '../../domain/constants/CacheDefaults';
11
- import type { Persister } from '@tanstack/react-query-persist-client';
12
11
 
13
12
  /**
14
13
  * Persister factory options
@@ -44,6 +43,7 @@ export interface PersisterFactoryOptions {
44
43
 
45
44
  /**
46
45
  * Create an AsyncStorage persister for TanStack Query
46
+ * Lazy loads the persistence packages to reduce initial bundle size
47
47
  *
48
48
  * @example
49
49
  * ```typescript
@@ -54,7 +54,15 @@ export interface PersisterFactoryOptions {
54
54
  * });
55
55
  * ```
56
56
  */
57
- export function createPersister(options: PersisterFactoryOptions = {}): Persister {
57
+ export async function createPersister(options: PersisterFactoryOptions = {}) {
58
+ // Lazy load TanStack persistence packages
59
+ const [{ createAsyncStoragePersister }, { default: { PersistQueryClient }] = await Promise.all([
60
+ import('@tanstack/query-async-storage-persister'),
61
+ import('@tanstack/react-query-persist-client'),
62
+ ]);
63
+
64
+ type Persister = ReturnType<typeof createAsyncStoragePersister>;
65
+
58
66
  const {
59
67
  keyPrefix = 'tanstack-query',
60
68
  maxAge = DEFAULT_GC_TIME.LONG,
@@ -106,7 +114,7 @@ export function createPersister(options: PersisterFactoryOptions = {}): Persiste
106
114
  return undefined;
107
115
  }
108
116
  },
109
- });
117
+ }) as Persister;
110
118
  }
111
119
 
112
120
  /**