@umituz/react-native-tanstack 1.2.16 → 1.2.17
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/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-tanstack",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.17",
|
|
4
4
|
"description": "TanStack Query configuration and utilities for React Native apps - Pre-configured QueryClient with AsyncStorage persistence",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -34,18 +34,18 @@
|
|
|
34
34
|
"@tanstack/react-query": "^5.66.7"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@react-native-async-storage/async-storage": ">=1.19.0",
|
|
38
37
|
"@tanstack/react-query": ">=5.0.0",
|
|
38
|
+
"@umituz/react-native-storage": ">=2.0.0",
|
|
39
39
|
"react": ">=18.2.0",
|
|
40
40
|
"react-native": ">=0.74.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@react-native-async-storage/async-storage": "^2.1.2",
|
|
44
43
|
"@tanstack/react-query": "^5.66.7",
|
|
45
44
|
"@types/react": "~19.1.10",
|
|
46
45
|
"react": "19.1.0",
|
|
47
46
|
"react-native": "0.81.5",
|
|
48
|
-
"typescript": "~5.9.2"
|
|
47
|
+
"typescript": "~5.9.2",
|
|
48
|
+
"@umituz/react-native-storage": "^2.6.23"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* General-purpose persistence configuration for any React Native app
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
9
8
|
import { createAsyncStoragePersister } from '@tanstack/query-async-storage-persister';
|
|
9
|
+
import { storageService } from '@umituz/react-native-storage';
|
|
10
10
|
import { DEFAULT_GC_TIME } from '../../domain/constants/CacheDefaults';
|
|
11
11
|
import type { Persister } from '@tanstack/react-query-persist-client';
|
|
12
12
|
|
|
@@ -63,7 +63,7 @@ export function createPersister(options: PersisterFactoryOptions = {}): Persiste
|
|
|
63
63
|
} = options;
|
|
64
64
|
|
|
65
65
|
return createAsyncStoragePersister({
|
|
66
|
-
storage:
|
|
66
|
+
storage: storageService,
|
|
67
67
|
key: `${keyPrefix}-cache`,
|
|
68
68
|
throttleTime,
|
|
69
69
|
serialize: (data) => {
|
|
@@ -123,7 +123,7 @@ export function createPersister(options: PersisterFactoryOptions = {}): Persiste
|
|
|
123
123
|
*/
|
|
124
124
|
export async function clearPersistedCache(keyPrefix: string = 'tanstack-query'): Promise<void> {
|
|
125
125
|
try {
|
|
126
|
-
await
|
|
126
|
+
await storageService.removeItem(`${keyPrefix}-cache`);
|
|
127
127
|
if (__DEV__) {
|
|
128
128
|
// eslint-disable-next-line no-console
|
|
129
129
|
console.log(`[TanStack Query] Cleared persisted cache: ${keyPrefix}`);
|
|
@@ -150,7 +150,7 @@ export async function getPersistedCacheSize(
|
|
|
150
150
|
keyPrefix: string = 'tanstack-query',
|
|
151
151
|
): Promise<number> {
|
|
152
152
|
try {
|
|
153
|
-
const data = await
|
|
153
|
+
const data = await storageService.getItem(`${keyPrefix}-cache`);
|
|
154
154
|
return data ? new Blob([data]).size : 0;
|
|
155
155
|
} catch (error) {
|
|
156
156
|
if (__DEV__) {
|