Skip to content
This repository was archived by the owner on Mar 1, 2026. It is now read-only.

Commit d14e1ba

Browse files
committed
update
1 parent ec22acd commit d14e1ba

2 files changed

Lines changed: 8 additions & 16 deletions

File tree

packages/orm/src/client/crud/validator/cache-decorator.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ export function cache() {
2121
// Build cache key object
2222
const cacheKeyObj: Record<string, unknown> = {
2323
$call: propertyKey,
24-
...args,
24+
...args.map((arg) => {
25+
if (Array.isArray(arg)) {
26+
// sort array arguments for consistent cache keys
27+
return [...arg].sort();
28+
} else {
29+
return arg;
30+
}
31+
}),
2532
};
2633

2734
// Generate stable string key

packages/orm/src/client/crud/validator/index.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,9 +1231,6 @@ export class InputValidator<Schema extends SchemaDef> {
12311231
withoutFields: string[] = [],
12321232
withoutRelationFields = false,
12331233
) {
1234-
// Normalize array argument for consistent cache keys
1235-
withoutFields = [...withoutFields].sort();
1236-
12371234
const uncheckedVariantFields: Record<string, ZodType> = {};
12381235
const checkedVariantFields: Record<string, ZodType> = {};
12391236
const modelDef = requireModel(this.schema, model);
@@ -1365,9 +1362,6 @@ export class InputValidator<Schema extends SchemaDef> {
13651362

13661363
@cache()
13671364
private makeRelationManipulationSchema(fieldDef: FieldDef, withoutFields: string[], mode: 'create' | 'update') {
1368-
// Normalize array argument for consistent cache keys
1369-
withoutFields = [...withoutFields].sort();
1370-
13711365
const fieldType = fieldDef.type;
13721366
const array = !!fieldDef.array;
13731367
const fields: Record<string, ZodType> = {
@@ -1472,9 +1466,6 @@ export class InputValidator<Schema extends SchemaDef> {
14721466

14731467
@cache()
14741468
private makeConnectOrCreateDataSchema(model: string, canBeArray: boolean, withoutFields: string[]) {
1475-
// Normalize array argument for consistent cache keys
1476-
withoutFields = [...withoutFields].sort();
1477-
14781469
const whereSchema = this.makeWhereSchema(model, true);
14791470
const createSchema = this.makeCreateDataSchema(model, false, withoutFields);
14801471
return this.orArray(
@@ -1488,9 +1479,6 @@ export class InputValidator<Schema extends SchemaDef> {
14881479

14891480
@cache()
14901481
private makeCreateManyDataSchema(model: string, withoutFields: string[]) {
1491-
// Normalize array argument for consistent cache keys
1492-
withoutFields = [...withoutFields].sort();
1493-
14941482
return z.strictObject({
14951483
data: this.makeCreateDataSchema(model, true, withoutFields, true),
14961484
skipDuplicates: z.boolean().optional(),
@@ -1558,9 +1546,6 @@ export class InputValidator<Schema extends SchemaDef> {
15581546

15591547
@cache()
15601548
private makeUpdateDataSchema(model: string, withoutFields: string[] = [], withoutRelationFields = false) {
1561-
// Normalize array argument for consistent cache keys
1562-
withoutFields = [...withoutFields].sort();
1563-
15641549
const uncheckedVariantFields: Record<string, ZodType> = {};
15651550
const checkedVariantFields: Record<string, ZodType> = {};
15661551
const modelDef = requireModel(this.schema, model);

0 commit comments

Comments
 (0)