Skip to content

Comments

fix(query-core): ensure onMutate runs synchronously when cache config is undefined (#8724)#2

Open
xxziiko wants to merge 2 commits intomainfrom
fix/issue-8724-sync-onmutate
Open

fix(query-core): ensure onMutate runs synchronously when cache config is undefined (#8724)#2
xxziiko wants to merge 2 commits intomainfrom
fix/issue-8724-sync-onmutate

Conversation

@xxziiko
Copy link
Owner

@xxziiko xxziiko commented Jan 22, 2026

🎯 Changes

Previously, mutationCache.config.onMutate was always awaited using optional chaining (await this.#mutationCache.config.onMutate?.()), which caused unnecessary async behavior even when the callback was undefined.

  • Changed to conditional check: only await when onMutate is actually defined
  • Added regression test to verify synchronous execution when cache config is not provided

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant