Skip to content

test(svelte-query/infiniteQueryOptions): add runtime test for identity function#10177

Merged
TkDodo merged 5 commits intoTanStack:mainfrom
sukvvon:test/svelte-query-infiniteQueryOptions-runtime
Feb 26, 2026
Merged

test(svelte-query/infiniteQueryOptions): add runtime test for identity function#10177
TkDodo merged 5 commits intoTanStack:mainfrom
sukvvon:test/svelte-query-infiniteQueryOptions-runtime

Conversation

@sukvvon
Copy link
Contributor

@sukvvon sukvvon commented Feb 24, 2026

🎯 Changes

Add a runtime test for infiniteQueryOptions identity function in @tanstack/svelte-query, matching the existing test in @tanstack/react-query.

✅ 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 a unit test ensuring infinite-query configuration objects (query key, fetch function, pagination parameters, and initial page) are preserved unchanged when passed into the library, confirming user-provided configs are not modified and reducing risk of regressions in pagination behavior.

@changeset-bot
Copy link

changeset-bot bot commented Feb 24, 2026

⚠️ No Changeset found

Latest commit: 556a57d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8a7b832 and 556a57d.

📒 Files selected for processing (1)
  • packages/svelte-query/tests/infiniteQueryOptions/infiniteQueryOptions.svelte.test.ts

📝 Walkthrough

Walkthrough

A new Vitest unit test was added to the svelte-query package that asserts infiniteQueryOptions returns the exact same input object (containing queryKey, queryFn, getNextPageParam, and initialPageParam) unchanged via strict equality.

Changes

Cohort / File(s) Summary
Test Addition
packages/svelte-query/tests/infiniteQueryOptions/infiniteQueryOptions.svelte.test.ts
Adds a Vitest unit test verifying infiniteQueryOptions returns the exact same input object (strict equality), ensuring no mutation or copying occurs.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • TkDodo

Poem

🐰 I hopped in to check a tiny score,
An object stayed whole, unchanged to the core,
No clones, no tweaks, just identity clear,
A quiet green tick, a small happy cheer,
Hop, hop — the test passed, and I twitched my ear.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main change: adding a runtime test for the infiniteQueryOptions identity function in svelte-query.
Description check ✅ Passed The description comprehensively covers all required template sections with clear explanations of changes and properly completed checklists indicating the contributor followed guidelines.
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 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 24, 2026

View your CI Pipeline Execution ↗ for commit 556a57d

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

☁️ Nx Cloud last updated this comment at 2026-02-26 12:57:46 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 24, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 556a57d

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@packages/svelte-query/tests/infiniteQueryOptions/infiniteQueryOptions.svelte.test.ts`:
- Line 14: The test currently asserts deep equality but intends to verify no
mutation/identity preservation: change the assertion in the test that calls
infiniteQueryOptions(object) so it asserts reference identity using toBe (you
can optionally keep toStrictEqual as an additional check), i.e., replace or
augment the existing expect(infiniteQueryOptions(object)).toStrictEqual(object)
with expect(...).toBe(object) while keeping the call to infiniteQueryOptions for
locating the check.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb7dca5 and b691a54.

📒 Files selected for processing (1)
  • packages/svelte-query/tests/infiniteQueryOptions/infiniteQueryOptions.svelte.test.ts

@TkDodo TkDodo merged commit 1f2aef9 into TanStack:main Feb 26, 2026
7 checks passed
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.

2 participants