@umituz/react-native-storage 2.6.17 → 2.6.19
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 +1 -1
- package/src/__tests__/{performance.test.ts → performance.test.tsx} +1 -0
- package/src/cache/__tests__/PerformanceAndMemory.test.ts +1 -0
- package/src/cache/domain/__tests__/Cache.test.ts +1 -0
- package/src/cache/presentation/__tests__/ReactHooks.test.ts +2 -1
- package/src/infrastructure/repositories/__tests__/AsyncStorageRepository.test.ts +1 -0
- package/src/infrastructure/repositories/__tests__/BaseStorageOperations.test.ts +1 -0
- package/src/presentation/hooks/CacheStorageOperations.ts +1 -2
- package/src/presentation/hooks/__tests__/usePersistentCache.test.ts +1 -0
- package/src/presentation/hooks/__tests__/useStorage.test.ts +1 -0
- package/src/presentation/hooks/__tests__/useStorageState.test.ts +1 -0
- package/src/presentation/hooks/usePersistentCache.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-storage",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.19",
|
|
4
4
|
"description": "Unified storage solution with AsyncStorage persistence, Zustand state management, and in-memory caching for React Native",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
1
2
|
/**
|
|
2
3
|
* React Hooks Integration Tests
|
|
3
4
|
*/
|
|
@@ -432,7 +433,7 @@ describe('React Hooks Integration', () => {
|
|
|
432
433
|
test('should cleanup on unmount', async () => {
|
|
433
434
|
const mockFetcher = jest.fn().mockResolvedValue('value');
|
|
434
435
|
|
|
435
|
-
const { unmount } = renderHook(() =>
|
|
436
|
+
const { result, unmount } = renderHook(() =>
|
|
436
437
|
useCachedValue('test-cache', 'test-key', mockFetcher)
|
|
437
438
|
);
|
|
438
439
|
|
|
@@ -42,8 +42,7 @@ export class CacheStorageOperations {
|
|
|
42
42
|
* Load cached data from storage
|
|
43
43
|
*/
|
|
44
44
|
async loadFromStorage<T>(
|
|
45
|
-
key: string
|
|
46
|
-
_version?: number
|
|
45
|
+
key: string
|
|
47
46
|
): Promise<CachedValue<T> | null> {
|
|
48
47
|
try {
|
|
49
48
|
const result = await storageRepository.getString(key, '');
|
|
@@ -105,7 +105,7 @@ export function usePersistentCache<T>(
|
|
|
105
105
|
actions.setLoading(true);
|
|
106
106
|
|
|
107
107
|
try {
|
|
108
|
-
const cached = await cacheOps.loadFromStorage<T>(key
|
|
108
|
+
const cached = await cacheOps.loadFromStorage<T>(key);
|
|
109
109
|
|
|
110
110
|
if (cached) {
|
|
111
111
|
const expired = isCacheExpired(cached, version);
|