Skip to content

test(query-core/mutationObserver): add test for skipping 'notify' when 'setOptions' is called with same options#10098

Open
sukvvon wants to merge 1 commit intoTanStack:mainfrom
sukvvon:test/query-core-mutationObserver-skip-notify-same-options
Open

test(query-core/mutationObserver): add test for skipping 'notify' when 'setOptions' is called with same options#10098
sukvvon wants to merge 1 commit intoTanStack:mainfrom
sukvvon:test/query-core-mutationObserver-skip-notify-same-options

Conversation

@sukvvon
Copy link
Contributor

@sukvvon sukvvon commented Feb 5, 2026

🎯 Changes

  • Add test to verify that MutationObserver.setOptions() does not emit observerOptionsUpdated notification when called with unchanged options
  • Covers the shallowEqualObjects check branch in setOptions

✅ 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).

Summary by CodeRabbit

  • Tests
    • Added test case to verify that the mutation observer correctly handles unchanged options without triggering unnecessary notifications.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

A new test case is added to the mutation observer test suite that verifies calling setOptions with identical options does not trigger a mutation cache notification event.

Changes

Cohort / File(s) Summary
Mutation Observer Tests
packages/query-core/src/__tests__/mutationObserver.test.tsx
Adds test case verifying that setOptions with unchanged options does not emit observerOptionsUpdated notification.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Suggested labels

package: query-core

Poem

🐰 A test hops in with careful grace,
Checking that unchanged options stay in place,
No notifications fly when nothing's new,
The mutation observer knows what to do!
thump thump

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a test case for MutationObserver.setOptions behavior when called with identical options.
Description check ✅ Passed The description includes all required sections from the template: Changes section with clear details, completed Checklist, and Release Impact section with appropriate selection.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@nx-cloud
Copy link

nx-cloud bot commented Feb 5, 2026

View your CI Pipeline Execution ↗ for commit 028d558

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 3m 28s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-05 13:02:23 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 5, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 028d558

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