@umituz/react-native-design-system 2.9.56 → 2.9.58
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.58",
|
|
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",
|
|
@@ -21,7 +21,7 @@ class DevMonitorClass {
|
|
|
21
21
|
this.isEnabled = __DEV__ ?? false;
|
|
22
22
|
this.options = {
|
|
23
23
|
slowQueryThreshold: options.slowQueryThreshold ?? 1000,
|
|
24
|
-
enableLogging: options.enableLogging ??
|
|
24
|
+
enableLogging: options.enableLogging ?? false,
|
|
25
25
|
statsLogInterval: options.statsLogInterval ?? 30000,
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -7,52 +7,64 @@ import type { QueryMetrics, CacheStats } from './DevMonitor.types';
|
|
|
7
7
|
|
|
8
8
|
export class DevMonitorLogger {
|
|
9
9
|
static logInit(): void {
|
|
10
|
-
|
|
10
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
11
|
+
console.log('[TanStack DevMonitor] Monitoring initialized');
|
|
12
|
+
}
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
static logSlowQuery(queryKeyString: string, fetchTime: number): void {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
17
|
+
console.warn(
|
|
18
|
+
`[TanStack DevMonitor] Slow query detected: ${queryKeyString} (${fetchTime}ms)`,
|
|
19
|
+
);
|
|
20
|
+
}
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
static logAttached(): void {
|
|
20
|
-
|
|
24
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
25
|
+
console.log('[TanStack DevMonitor] Attached to QueryClient');
|
|
26
|
+
}
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
static logMethodsCleared(): void {
|
|
24
|
-
|
|
30
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
31
|
+
console.log('[TanStack DevMonitor] Metrics cleared');
|
|
32
|
+
}
|
|
25
33
|
}
|
|
26
34
|
|
|
27
35
|
static logReset(): void {
|
|
28
|
-
|
|
36
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
37
|
+
console.log('[TanStack DevMonitor] Reset');
|
|
38
|
+
}
|
|
29
39
|
}
|
|
30
40
|
|
|
31
41
|
static logReport(stats: CacheStats | null, slowQueries: QueryMetrics[]): void {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (stats) {
|
|
35
|
-
console.table({
|
|
36
|
-
'Total Queries': stats.totalQueries,
|
|
37
|
-
'Active Queries': stats.activeQueries,
|
|
38
|
-
'Cached Queries': stats.cachedQueries,
|
|
39
|
-
'Stale Queries': stats.staleQueries,
|
|
40
|
-
'Inactive Queries': stats.inactiveQueries,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
42
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
43
|
+
console.group('[TanStack DevMonitor] Performance Report');
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
);
|
|
54
|
-
}
|
|
45
|
+
if (stats) {
|
|
46
|
+
console.table({
|
|
47
|
+
'Total Queries': stats.totalQueries,
|
|
48
|
+
'Active Queries': stats.activeQueries,
|
|
49
|
+
'Cached Queries': stats.cachedQueries,
|
|
50
|
+
'Stale Queries': stats.staleQueries,
|
|
51
|
+
'Inactive Queries': stats.inactiveQueries,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
55
54
|
|
|
56
|
-
|
|
55
|
+
if (slowQueries.length > 0) {
|
|
56
|
+
console.warn(`Found ${slowQueries.length} slow queries:`);
|
|
57
|
+
console.table(
|
|
58
|
+
slowQueries.map((m) => ({
|
|
59
|
+
queryKey: JSON.stringify(m.queryKey),
|
|
60
|
+
fetchCount: m.fetchCount,
|
|
61
|
+
avgTime: `${m.averageFetchTime.toFixed(2)}ms`,
|
|
62
|
+
slowCount: m.slowFetchCount,
|
|
63
|
+
})),
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
console.groupEnd();
|
|
68
|
+
}
|
|
57
69
|
}
|
|
58
70
|
}
|
|
@@ -5,6 +5,7 @@ import type { Persister } from '@tanstack/react-query-persist-client';
|
|
|
5
5
|
import { createQueryClient, type QueryClientFactoryOptions } from '../config/QueryClientConfig';
|
|
6
6
|
import { createPersister, type PersisterFactoryOptions } from '../config/PersisterConfig';
|
|
7
7
|
import { setGlobalQueryClient } from '../config/QueryClientSingleton';
|
|
8
|
+
import { DevMonitor } from '../monitoring/DevMonitor';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* TanStack provider props
|
|
@@ -33,6 +34,12 @@ export interface TanstackProviderProps {
|
|
|
33
34
|
*/
|
|
34
35
|
enablePersistence?: boolean;
|
|
35
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Enable DevMonitor logging (development only)
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
enableDevTools?: boolean;
|
|
42
|
+
|
|
36
43
|
/**
|
|
37
44
|
* Custom persister instance
|
|
38
45
|
* Only used if enablePersistence is true
|
|
@@ -64,6 +71,7 @@ export function TanstackProvider({
|
|
|
64
71
|
queryClient: providedQueryClient,
|
|
65
72
|
queryClientOptions,
|
|
66
73
|
enablePersistence = true,
|
|
74
|
+
enableDevTools = false,
|
|
67
75
|
persister: providedPersister,
|
|
68
76
|
persisterOptions,
|
|
69
77
|
onPersistSuccess,
|
|
@@ -73,6 +81,11 @@ export function TanstackProvider({
|
|
|
73
81
|
const [queryClient] = React.useState(() => {
|
|
74
82
|
const client = providedQueryClient ?? createQueryClient(queryClientOptions);
|
|
75
83
|
setGlobalQueryClient(client);
|
|
84
|
+
|
|
85
|
+
if (enableDevTools && typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
86
|
+
DevMonitor.attach(client);
|
|
87
|
+
}
|
|
88
|
+
|
|
76
89
|
return client;
|
|
77
90
|
});
|
|
78
91
|
|