Skip to content

Commit 29bf3e6

Browse files
committed
fix: address PR comments
1 parent 78bee26 commit 29bf3e6

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

packages/clients/tanstack-query/src/common/transaction.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ export function makeTransactionOnSuccess(
3737
origOnSuccess: ((...args: any[]) => any) | undefined,
3838
) {
3939
return async (...args: any[]) => {
40-
const variables = args[1] as TransactionOperation[];
40+
const variables = Array.isArray(args[1]) ? (args[1] as TransactionOperation[]) : [];
4141
for (const op of variables) {
42+
if (typeof op?.model !== 'string' || typeof op?.op !== 'string') {
43+
continue;
44+
}
4245
const invalidator = createInvalidator(op.model, op.op, schema, invalidateFunc, logging);
4346
// pass op.args as mutation variables so the invalidator can analyze nested writes
4447
await invalidator(args[0], op.args, args[2]);

0 commit comments

Comments
 (0)