@assistant-ui/tap 0.5.3 → 0.5.5
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": "@assistant-ui/tap",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "Zero-dependency reactive state management inspired by React hooks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"state-management",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"@types/node": "^25.5.0",
|
|
52
52
|
"@types/react": "^19.2.14",
|
|
53
53
|
"@types/react-dom": "^19.2.3",
|
|
54
|
-
"@vitest/ui": "^4.1.
|
|
55
|
-
"jsdom": "^
|
|
54
|
+
"@vitest/ui": "^4.1.1",
|
|
55
|
+
"jsdom": "^29.0.1",
|
|
56
56
|
"react": "19.2.4",
|
|
57
57
|
"react-dom": "19.2.4",
|
|
58
|
-
"vitest": "^4.1.
|
|
58
|
+
"vitest": "^4.1.1",
|
|
59
59
|
"@assistant-ui/x-buildutils": "0.0.3"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* These tests should mirror the React strict mode behavior
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { describe, it, expect } from "vitest";
|
|
6
|
+
import { afterEach, describe, it, expect, vi } from "vitest";
|
|
7
7
|
import { resource } from "../../core/resource";
|
|
8
8
|
import { tapState } from "../../hooks/tap-state";
|
|
9
9
|
import { tapEffect } from "../../hooks/tap-effect";
|
|
@@ -202,7 +202,13 @@ describe("Tap Strict Mode - Rerender Sources", () => {
|
|
|
202
202
|
});
|
|
203
203
|
|
|
204
204
|
describe("Source 4: setState in setTimeout", () => {
|
|
205
|
+
afterEach(() => {
|
|
206
|
+
vi.useRealTimers();
|
|
207
|
+
});
|
|
208
|
+
|
|
205
209
|
it("should double-render AND double-call setTimeout callback", async () => {
|
|
210
|
+
vi.useFakeTimers();
|
|
211
|
+
|
|
206
212
|
const events: string[] = [];
|
|
207
213
|
|
|
208
214
|
const TestResource = resource(() => {
|
|
@@ -224,7 +230,10 @@ describe("Tap Strict Mode - Rerender Sources", () => {
|
|
|
224
230
|
const root = createResourceRoot();
|
|
225
231
|
root.render(TestResource());
|
|
226
232
|
|
|
227
|
-
//
|
|
233
|
+
// Fire both setTimeout callbacks synchronously via fake timers
|
|
234
|
+
vi.advanceTimersByTime(10);
|
|
235
|
+
// Restore real timers and wait for the scheduler flush (via MessageChannel)
|
|
236
|
+
vi.useRealTimers();
|
|
228
237
|
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
229
238
|
|
|
230
239
|
// React behavior: setTimeout callbacks run TWICE, then renders double
|