@svadmin/ui 0.69.0 → 0.70.0
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.
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount } from 'svelte';
|
|
3
|
-
import { SvelteMap } from 'svelte/reactivity';
|
|
4
3
|
import { fly } from 'svelte/transition';
|
|
5
4
|
import { useQueryClient } from '@tanstack/svelte-query';
|
|
6
5
|
import {
|
|
@@ -56,10 +55,13 @@
|
|
|
56
55
|
let collapsed = $state(false);
|
|
57
56
|
let cacheDiagnostics = $state.raw<CacheDiagnostics>(EMPTY_CACHE_DIAGNOSTICS);
|
|
58
57
|
let safeQueryDiagnostics = $state.raw<SafeQueryDiagnostic[]>([]);
|
|
59
|
-
const queryTimings = new
|
|
58
|
+
const queryTimings = new Map<string, { startedAt?: number; duration?: number }>();
|
|
60
59
|
|
|
61
60
|
function toggle() {
|
|
62
61
|
visible = !visible;
|
|
62
|
+
if (visible) {
|
|
63
|
+
refreshCacheDiagnostics();
|
|
64
|
+
}
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
function handleKeydown(event: KeyboardEvent) {
|
|
@@ -107,9 +109,20 @@
|
|
|
107
109
|
});
|
|
108
110
|
}
|
|
109
111
|
|
|
112
|
+
let refreshScheduled = false;
|
|
113
|
+
function scheduleRefreshCacheDiagnostics() {
|
|
114
|
+
if (!visible || refreshScheduled) return;
|
|
115
|
+
refreshScheduled = true;
|
|
116
|
+
queueMicrotask(() => {
|
|
117
|
+
refreshScheduled = false;
|
|
118
|
+
if (visible) {
|
|
119
|
+
refreshCacheDiagnostics();
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
110
124
|
onMount(() => {
|
|
111
125
|
if (!isDev) return;
|
|
112
|
-
refreshCacheDiagnostics();
|
|
113
126
|
const unsubscribeQueries = queryClient.getQueryCache().subscribe((event) => {
|
|
114
127
|
// Observer events arrive in pairs during component rerenders. Refreshing diagnostics triggers another render,
|
|
115
128
|
// so respond only to events that actually change cached content or request state.
|
|
@@ -126,9 +139,9 @@
|
|
|
126
139
|
});
|
|
127
140
|
}
|
|
128
141
|
}
|
|
129
|
-
|
|
142
|
+
scheduleRefreshCacheDiagnostics();
|
|
130
143
|
});
|
|
131
|
-
const unsubscribeMutations = queryClient.getMutationCache().subscribe(
|
|
144
|
+
const unsubscribeMutations = queryClient.getMutationCache().subscribe(scheduleRefreshCacheDiagnostics);
|
|
132
145
|
return () => {
|
|
133
146
|
unsubscribeQueries();
|
|
134
147
|
unsubscribeMutations();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.70.0",
|
|
4
4
|
"description": "Pre-built admin UI components — AdminApp, AutoTable, AutoForm, Sidebar, Layout",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"./components/*": "./dist/components/*"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@svadmin/core": "^0.
|
|
43
|
+
"@svadmin/core": "^0.50.0",
|
|
44
44
|
"@tanstack/svelte-query": "^6.1.48",
|
|
45
45
|
"isomorphic-dompurify": "^3.23.0",
|
|
46
46
|
"svelte": "^5.56.10"
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"@happy-dom/global-registrator": "^20.11.12",
|
|
91
|
-
"@svadmin/ai-elements": "^0.
|
|
91
|
+
"@svadmin/ai-elements": "^0.5.1",
|
|
92
92
|
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|
|
93
93
|
"@tailwindcss/node": "^4.3.3",
|
|
94
94
|
"@testing-library/dom": "^10.4.1",
|