@umituz/react-native-design-system 2.8.45 → 2.8.46
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/media/infrastructure/utils/mediaPickerMappers.ts +1 -1
- package/src/tanstack/domain/repositories/BaseRepository.ts +1 -1
- package/src/tanstack/infrastructure/config/PersisterConfig.ts +2 -2
- package/src/tanstack/infrastructure/config/QueryClientConfig.ts +2 -2
- package/src/tanstack/infrastructure/monitoring/DevMonitor.ts +8 -6
- package/src/tanstack/presentation/hooks/usePaginatedQuery.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.46",
|
|
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, and onboarding utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -57,7 +57,7 @@ export const mapPickerResult = (
|
|
|
57
57
|
return { canceled: true };
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
const assets: MediaAsset[] = result.assets.map((asset) => ({
|
|
60
|
+
const assets: MediaAsset[] = result.assets.map((asset: ImagePicker.ImagePickerAsset) => ({
|
|
61
61
|
uri: asset.uri,
|
|
62
62
|
width: asset.width,
|
|
63
63
|
height: asset.height,
|
|
@@ -188,7 +188,7 @@ export abstract class BaseRepository<
|
|
|
188
188
|
invalidateAll(): Promise<void> {
|
|
189
189
|
const client = this.getClient();
|
|
190
190
|
return client.invalidateQueries({
|
|
191
|
-
predicate: (query) => {
|
|
191
|
+
predicate: (query: { queryKey: readonly unknown[] }) => {
|
|
192
192
|
const key = query.queryKey[0] as string;
|
|
193
193
|
return key === this.resource;
|
|
194
194
|
},
|
|
@@ -66,7 +66,7 @@ export function createPersister(options: PersisterFactoryOptions = {}): Persiste
|
|
|
66
66
|
storage: storageService,
|
|
67
67
|
key: `${keyPrefix}-cache`,
|
|
68
68
|
throttleTime,
|
|
69
|
-
serialize: (data) => {
|
|
69
|
+
serialize: (data: unknown) => {
|
|
70
70
|
// Add metadata for cache validation
|
|
71
71
|
const persistData = {
|
|
72
72
|
version: busterVersion,
|
|
@@ -75,7 +75,7 @@ export function createPersister(options: PersisterFactoryOptions = {}): Persiste
|
|
|
75
75
|
};
|
|
76
76
|
return JSON.stringify(persistData);
|
|
77
77
|
},
|
|
78
|
-
deserialize: (cachedString) => {
|
|
78
|
+
deserialize: (cachedString: string) => {
|
|
79
79
|
try {
|
|
80
80
|
const parsed = JSON.parse(cachedString);
|
|
81
81
|
|
|
@@ -125,9 +125,9 @@ export function createQueryClient(options: QueryClientFactoryOptions = {}): Quer
|
|
|
125
125
|
},
|
|
126
126
|
mutations: {
|
|
127
127
|
retry: DEFAULT_RETRY.MINIMAL,
|
|
128
|
-
onError: (error) => {
|
|
128
|
+
onError: (error: Error) => {
|
|
129
129
|
if (enableDevLogging) {
|
|
130
|
-
|
|
130
|
+
|
|
131
131
|
console.error('[TanStack Query] Mutation error:', error);
|
|
132
132
|
}
|
|
133
133
|
},
|
|
@@ -81,8 +81,10 @@ class DevMonitorClass {
|
|
|
81
81
|
if (!this.isEnabled) return;
|
|
82
82
|
|
|
83
83
|
this.queryClient = queryClient;
|
|
84
|
-
queryClient.getQueryCache().subscribe((
|
|
85
|
-
|
|
84
|
+
queryClient.getQueryCache().subscribe((event) => {
|
|
85
|
+
if (event.query) {
|
|
86
|
+
this.trackQuery(event.query as Query);
|
|
87
|
+
}
|
|
86
88
|
});
|
|
87
89
|
|
|
88
90
|
if (this.options.enableLogging) {
|
|
@@ -126,10 +128,10 @@ class DevMonitorClass {
|
|
|
126
128
|
|
|
127
129
|
return {
|
|
128
130
|
totalQueries: queries.length,
|
|
129
|
-
activeQueries: queries.filter((q) => q.observers.length > 0).length,
|
|
130
|
-
cachedQueries: queries.filter((q) => q.state.data !== undefined).length,
|
|
131
|
-
staleQueries: queries.filter((q) => q.isStale()).length,
|
|
132
|
-
inactiveQueries: queries.filter((q) => q.observers.length === 0).length,
|
|
131
|
+
activeQueries: queries.filter((q: Query) => q.observers.length > 0).length,
|
|
132
|
+
cachedQueries: queries.filter((q: Query) => q.state.data !== undefined).length,
|
|
133
|
+
staleQueries: queries.filter((q: Query) => q.isStale()).length,
|
|
134
|
+
inactiveQueries: queries.filter((q: Query) => q.observers.length === 0).length,
|
|
133
135
|
};
|
|
134
136
|
}
|
|
135
137
|
|
|
@@ -63,7 +63,7 @@ export function useCursorPagination<TData>(options: CursorPaginationOptions<TDat
|
|
|
63
63
|
|
|
64
64
|
const result = useInfiniteQuery({
|
|
65
65
|
queryKey,
|
|
66
|
-
queryFn: ({ pageParam }) => queryFn({ pageParam }),
|
|
66
|
+
queryFn: ({ pageParam }: { pageParam: string | undefined }) => queryFn({ pageParam }),
|
|
67
67
|
initialPageParam: undefined as string | undefined,
|
|
68
68
|
getNextPageParam: (lastPage: CursorPaginatedResponse<TData>) =>
|
|
69
69
|
lastPage.hasMore ? lastPage.nextCursor : undefined,
|
|
@@ -72,7 +72,7 @@ export function useCursorPagination<TData>(options: CursorPaginationOptions<TDat
|
|
|
72
72
|
|
|
73
73
|
const flatData = useMemo(() => {
|
|
74
74
|
if (!result.data?.pages) return [];
|
|
75
|
-
return result.data.pages.flatMap((page) => page.items);
|
|
75
|
+
return result.data.pages.flatMap((page: CursorPaginatedResponse<TData>) => page.items);
|
|
76
76
|
}, [result.data]);
|
|
77
77
|
|
|
78
78
|
return {
|
|
@@ -104,7 +104,7 @@ export function useOffsetPagination<TData>(options: OffsetPaginationOptions<TDat
|
|
|
104
104
|
|
|
105
105
|
const result = useInfiniteQuery({
|
|
106
106
|
queryKey,
|
|
107
|
-
queryFn: ({ pageParam }) => queryFn({ pageParam }),
|
|
107
|
+
queryFn: ({ pageParam }: { pageParam: OffsetPageParam }) => queryFn({ pageParam }),
|
|
108
108
|
initialPageParam: { offset: 0, limit },
|
|
109
109
|
getNextPageParam: (lastPage: OffsetPaginatedResponse<TData>) => {
|
|
110
110
|
const nextOffset = lastPage.offset + lastPage.limit;
|
|
@@ -115,7 +115,7 @@ export function useOffsetPagination<TData>(options: OffsetPaginationOptions<TDat
|
|
|
115
115
|
|
|
116
116
|
const flatData = useMemo(() => {
|
|
117
117
|
if (!result.data?.pages) return [];
|
|
118
|
-
return result.data.pages.flatMap((page) => page.items);
|
|
118
|
+
return result.data.pages.flatMap((page: OffsetPaginatedResponse<TData>) => page.items);
|
|
119
119
|
}, [result.data]);
|
|
120
120
|
|
|
121
121
|
const total = result.data?.pages?.[result.data.pages.length - 1]?.total ?? 0;
|