fix: Add debounced Undo/Redo system to avoid character-by-character history
- Add debounced state updates for title and content (500ms delay) - Immediate UI updates with delayed history saving - Prevent one-letter-per-undo issue - Add cleanup for debounce timers on unmount
This commit is contained in:
29
mcp-server/node_modules/zod/src/v3/tests/pipeline.test.ts
generated
vendored
Normal file
29
mcp-server/node_modules/zod/src/v3/tests/pipeline.test.ts
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
// @ts-ignore TS6133
|
||||
import { expect, test } from "vitest";
|
||||
|
||||
import * as z from "zod/v3";
|
||||
|
||||
test("string to number pipeline", () => {
|
||||
const schema = z.string().transform(Number).pipe(z.number());
|
||||
expect(schema.parse("1234")).toEqual(1234);
|
||||
});
|
||||
|
||||
test("string to number pipeline async", async () => {
|
||||
const schema = z
|
||||
.string()
|
||||
.transform(async (val) => Number(val))
|
||||
.pipe(z.number());
|
||||
expect(await schema.parseAsync("1234")).toEqual(1234);
|
||||
});
|
||||
|
||||
test("break if dirty", () => {
|
||||
const schema = z
|
||||
.string()
|
||||
.refine((c) => c === "1234")
|
||||
.transform(async (val) => Number(val))
|
||||
.pipe(z.number().refine((v) => v < 100));
|
||||
const r1: any = schema.safeParse("12345");
|
||||
expect(r1.error.issues.length).toBe(1);
|
||||
const r2: any = schema.safeParse("3");
|
||||
expect(r2.error.issues.length).toBe(1);
|
||||
});
|
||||
Reference in New Issue
Block a user