We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ed933d9 commit 0d87aa4Copy full SHA for 0d87aa4
packages/zod/src/v4/core/schemas.ts
@@ -171,7 +171,8 @@ export interface _$ZodType<T extends $ZodTypeInternals = $ZodTypeInternals>
171
172
export const $ZodType: core.$constructor<$ZodType> = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def) => {
173
inst ??= {} as any;
174
- inst._zod.id = def.type + "_" + util.randomString(10);
+ // avoids issues with using Math.random() in Next.js caching
175
+ util.defineLazy(inst._zod, "id", () => def.type + "_" + util.randomString(10));
176
inst._zod.def = def; // set _def property
177
inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
178
inst._zod.version = version;
0 commit comments