@djangocfg/ui-core 2.1.378 → 2.1.380
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": "@djangocfg/ui-core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.380",
|
|
4
4
|
"description": "Pure React UI component library without Next.js dependencies - for Electron, Vite, CRA apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui-components",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"playground": "playground dev"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
|
-
"@djangocfg/i18n": "^2.1.
|
|
99
|
+
"@djangocfg/i18n": "^2.1.380",
|
|
100
100
|
"consola": "^3.4.2",
|
|
101
101
|
"lucide-react": "^0.545.0",
|
|
102
102
|
"moment": "^2.30.1",
|
|
@@ -166,9 +166,9 @@
|
|
|
166
166
|
"vaul": "1.1.2"
|
|
167
167
|
},
|
|
168
168
|
"devDependencies": {
|
|
169
|
-
"@djangocfg/i18n": "^2.1.
|
|
169
|
+
"@djangocfg/i18n": "^2.1.380",
|
|
170
170
|
"@djangocfg/playground": "workspace:*",
|
|
171
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
171
|
+
"@djangocfg/typescript-config": "^2.1.380",
|
|
172
172
|
"@types/node": "^24.7.2",
|
|
173
173
|
"@types/react": "^19.1.0",
|
|
174
174
|
"@types/react-dom": "^19.1.0",
|
|
@@ -62,14 +62,26 @@ function patchHistoryOnce(): void {
|
|
|
62
62
|
const originalPush = window.history.pushState.bind(window.history);
|
|
63
63
|
const originalReplace = window.history.replaceState.bind(window.history);
|
|
64
64
|
|
|
65
|
+
// Defer dispatch to a microtask so the events fire AFTER the caller's
|
|
66
|
+
// current commit/insertion phase. Otherwise React fires useInsertionEffect
|
|
67
|
+
// → next/link calls pushState → patched handler synchronously dispatches →
|
|
68
|
+
// useSyncExternalStore subscribers schedule state updates inside the same
|
|
69
|
+
// insertion phase → React throws "useInsertionEffect must not schedule
|
|
70
|
+
// updates". queueMicrotask preserves event ordering relative to other
|
|
71
|
+
// microtasks (Promise resolutions) without yielding to the macrotask queue.
|
|
72
|
+
const dispatchDeferred = (...events: string[]) => {
|
|
73
|
+
queueMicrotask(() => {
|
|
74
|
+
for (const name of events) window.dispatchEvent(new Event(name));
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
|
|
65
78
|
window.history.pushState = function patchedPushState(
|
|
66
79
|
...args: Parameters<History['pushState']>
|
|
67
80
|
) {
|
|
68
81
|
const result = originalPush(...args);
|
|
69
82
|
// Two events: the per-method one (consumers can listen narrowly)
|
|
70
83
|
// and a generic NAVIGATE_EVENT for "any url change" subscribers.
|
|
71
|
-
|
|
72
|
-
window.dispatchEvent(new Event(NAVIGATE_EVENT));
|
|
84
|
+
dispatchDeferred(PUSH_STATE_EVENT, NAVIGATE_EVENT);
|
|
73
85
|
return result;
|
|
74
86
|
};
|
|
75
87
|
|
|
@@ -77,8 +89,7 @@ function patchHistoryOnce(): void {
|
|
|
77
89
|
...args: Parameters<History['replaceState']>
|
|
78
90
|
) {
|
|
79
91
|
const result = originalReplace(...args);
|
|
80
|
-
|
|
81
|
-
window.dispatchEvent(new Event(NAVIGATE_EVENT));
|
|
92
|
+
dispatchDeferred(REPLACE_STATE_EVENT, NAVIGATE_EVENT);
|
|
82
93
|
return result;
|
|
83
94
|
};
|
|
84
95
|
|