Skip to content

test(query-core/utils,vue-query/mutationOptions): assert reference identity with 'toBe' - #11048

Merged
sukvvon merged 1 commit into
mainfrom
test/pass-through-reference-identity
Jul 11, 2026
Merged

test(query-core/utils,vue-query/mutationOptions): assert reference identity with 'toBe'#11048
sukvvon merged 1 commit into
mainfrom
test/pass-through-reference-identity

Conversation

@sukvvon

@sukvvonsukvvon commented Jul 11, 2026

Copy link
Copy Markdown
Member

🎯 Changes

keepPreviousData and mutationOptions are pure pass-through helpers that return the exact same reference they receive (return previousData / return options). Their tests asserted the return value with toEqual/toStrictEqual, which only compares by value — so they would still pass even if the helper wrongly returned a copy (e.g. { ...options }), missing the "return as is" contract. This switches them to toBe, which asserts reference identity — the actual contract.

✅ Checklist

🚀 Release Impact

  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Updated automated tests to verify that returned and provided objects preserve their original references.
    • Improved coverage for data retention and mutation option handling without changing end-user functionality.

@nx-cloud

nx-cloudBot commented Jul 11, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 794dc88

CommandStatusDurationResult
nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded7m 48sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded1m 52sView ↗

☁️ Nx Cloud last updated this comment at 2026-07-11 05:22:48 UTC

@coderabbitai

coderabbitaiBot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e8bca3c8-9311-4e11-970c-3b27b03f7be4

📥 Commits

Reviewing files that changed from the base of the PR and between 7bc3415 and 794dc88.

📒 Files selected for processing (2)
  • packages/query-core/src/__tests__/utils.test.tsx
  • packages/vue-query/src/__tests__/mutationOptions.test.ts

📝 Walkthrough

Walkthrough

Tests for keepPreviousData and mutationOptions now verify that returned objects preserve the same reference identity as their inputs.

Changes

Reference identity tests

Layer / File(s)Summary
Reference identity assertions
packages/query-core/src/__tests__/utils.test.tsx, packages/vue-query/src/__tests__/mutationOptions.test.ts
Changed object comparisons from deep equality to reference equality in three unit test assertions.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly matches the main change: switching tests to assert reference identity with toBe.
Description check✅ PassedThe description follows the template and includes the changes, checklist, and release impact sections.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/pass-through-reference-identity

Comment @coderabbitai help to get the list of available commands.

@sukvvonsukvvon self-assigned this Jul 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@pkg-pr-new

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@11048

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@11048

@tanstack/lit-query

npm i https://pkg.pr.new/@tanstack/lit-query@11048

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@11048

@tanstack/preact-query-devtools

npm i https://pkg.pr.new/@tanstack/preact-query-devtools@11048

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@11048

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@11048

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@11048

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@11048

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@11048

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@11048

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@11048

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@11048

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@11048

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@11048

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@11048

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@11048

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@11048

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@11048

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@11048

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@11048

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@11048

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@11048

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@11048

commit: 794dc88

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
react full12.13 KB (0%)
react minimal9.08 KB (0%)

@sukvvon
sukvvon merged commit 0cdfdea into mainJul 11, 2026
9 checks passed
@sukvvon
sukvvon deleted the test/pass-through-reference-identity branch July 11, 2026 05:52
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@sukvvon