Skip to content

test(query-core/utils): add test for exposing the signal on the query context in 'addConsumeAwareSignal'#10863

Merged
sukvvon merged 1 commit into
mainfrom
test/query-core-utils-signal-on-query-context
Jun 3, 2026
Merged

test(query-core/utils): add test for exposing the signal on the query context in 'addConsumeAwareSignal'#10863
sukvvon merged 1 commit into
mainfrom
test/query-core-utils-signal-on-query-context

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Jun 3, 2026

🎯 Changes

Adds a unit test for addConsumeAwareSignal covering its core contract: the helper attaches a lazy signal property to the given query context object while preserving the object's original properties.

This mirrors how streamedQuery and infiniteQueryBehavior rely on the helper to expose an AbortSignal on the query function context.

✅ 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 coverage for signal handling in query context, verifying proper signal factory behavior and context exposure.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5e219506-f235-4bb1-98ee-12449bcd189d

📥 Commits

Reviewing files that changed from the base of the PR and between d29f7db and 1432059.

📒 Files selected for processing (1)
  • packages/query-core/src/__tests__/utils.test.tsx

📝 Walkthrough

Walkthrough

Adds a unit test for addConsumeAwareSignal that verifies the returned query context preserves the original queryKey and exposes the same signal instance from the signal factory.

Changes

addConsumeAwareSignal test coverage

Layer / File(s) Summary
addConsumeAwareSignal context test
packages/query-core/src/__tests__/utils.test.tsx
New test asserts that the produced context preserves the provided queryKey and exposes the same signal instance returned by the signal factory.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • TanStack/query#10862: Both PRs add unit coverage for addConsumeAwareSignal behavior; this PR tests context and signal preservation while the related PR tests signal cancellation handling.

Poem

🐰 A signal so swift, a test that won't fail,
The context preserved, the abort won't derail,
One line at a time, we verify and check,
That queries stay keen and signals stay spec! 🎯

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a test for signal exposure on query context in the addConsumeAwareSignal utility.
Description check ✅ Passed The description follows the template structure with filled-in Changes section, completed Checklist items, and Release Impact selection indicating dev-only changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ 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/query-core-utils-signal-on-query-context

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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

@sukvvon sukvvon self-assigned this Jun 3, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Jun 3, 2026

View your CI Pipeline Execution ↗ for commit 1432059

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 1m 28s View ↗

☁️ Nx Cloud last updated this comment at 2026-06-03 11:56:02 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

🚀 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

pkg-pr-new Bot commented Jun 3, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 1432059

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

size-limit report 📦

Path Size
react full 12.11 KB (0%)
react minimal 9.08 KB (0%)

@sukvvon sukvvon merged commit 304eb09 into main Jun 3, 2026
11 of 12 checks passed
@sukvvon sukvvon deleted the test/query-core-utils-signal-on-query-context branch June 3, 2026 11:56
Sign up for free to 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