Skip to content

test(query-devtools/contexts/PiPContext): add test for 'usePiPWindow' throwing outside a 'PiPProvider'#10796

Merged
sukvvon merged 1 commit into
mainfrom
test/query-devtools-pipcontext-outside-provider-throw
May 25, 2026
Merged

test(query-devtools/contexts/PiPContext): add test for 'usePiPWindow' throwing outside a 'PiPProvider'#10796
sukvvon merged 1 commit into
mainfrom
test/query-devtools-pipcontext-outside-provider-throw

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented May 25, 2026

🎯 Changes

Open a src/__tests__/contexts/PiPContext.test.tsx (matching the ThemeContext / QueryDevtoolsContext splits from #10787 / #10793) with one case: usePiPWindow must throw outside a PiPProvider. This is the hand-written guard the module owns to surface a clear error instead of letting consumers read from a missing context.

Use the same render + probe-component pattern as the sibling context test files so the helper shape stays consistent across the directory. usePiPWindow wraps the context lookup in createMemo, which Solid evaluates immediately when the probe mounts, so the render call itself raises the error.

✅ 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 validation ensuring usePiPWindow properly throws an error when invoked outside the required context.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 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: 5f4eb42f-a64e-4907-9a9f-7705614ac02a

📥 Commits

Reviewing files that changed from the base of the PR and between d49b47f and 72bf83e.

📒 Files selected for processing (1)
  • packages/query-devtools/src/__tests__/contexts/PiPContext.test.tsx

📝 Walkthrough

Walkthrough

A new Vitest test renders a component that calls usePiPWindow outside a PiPProvider and asserts the render throws the exact provider-missing error message.

Changes

PiPContext Provider Error Validation

Layer / File(s) Summary
PiPContext provider error validation
packages/query-devtools/src/__tests__/contexts/PiPContext.test.tsx
Adds a Vitest test that renders a probe component which calls usePiPWindow without a PiPProvider and asserts the render throws the exact error string.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • TanStack/query#10752: Related test additions in packages/query-devtools asserting component render/error behavior for devtools components.

Suggested labels

package: query-devtools

Poem

A rabbit tests with careful twitch,
Hops in to catch a missing switch.
When PiP is called with none around,
The error sings—so safe and sound. 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change—adding a test for usePiPWindow throwing outside a PiPProvider, which matches the changeset.
Description check ✅ Passed The description covers all required template sections: detailed Changes explanation, completed Checklist with both items marked, and Release Impact clearly marked as dev-only.
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-devtools-pipcontext-outside-provider-throw

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

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 25, 2026

View your CI Pipeline Execution ↗ for commit d49b47f

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

☁️ Nx Cloud last updated this comment at 2026-05-25 18:11:58 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 25, 2026

🚀 Changeset Version Preview

2 package(s) bumped directly, 23 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/lit-query 0.2.6 → 0.2.7 Changeset
@tanstack/query-devtools 5.100.14 → 5.100.15 Changeset
@tanstack/angular-query-experimental 5.100.14 → 5.100.15 Dependent
@tanstack/angular-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/eslint-plugin-query 5.100.14 → 5.100.15 Dependent
@tanstack/preact-query 5.100.14 → 5.100.15 Dependent
@tanstack/preact-query-devtools 5.100.14 → 5.100.15 Dependent
@tanstack/preact-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/query-async-storage-persister 5.100.14 → 5.100.15 Dependent
@tanstack/query-broadcast-client-experimental 5.100.14 → 5.100.15 Dependent
@tanstack/query-core 5.100.14 → 5.100.15 Dependent
@tanstack/query-persist-client-core 5.100.14 → 5.100.15 Dependent
@tanstack/query-sync-storage-persister 5.100.14 → 5.100.15 Dependent
@tanstack/react-query 5.100.14 → 5.100.15 Dependent
@tanstack/react-query-devtools 5.100.14 → 5.100.15 Dependent
@tanstack/react-query-next-experimental 5.100.14 → 5.100.15 Dependent
@tanstack/react-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/solid-query 5.100.14 → 5.100.15 Dependent
@tanstack/solid-query-devtools 5.100.14 → 5.100.15 Dependent
@tanstack/solid-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/svelte-query 6.1.33 → 6.1.34 Dependent
@tanstack/svelte-query-devtools 6.1.33 → 6.1.34 Dependent
@tanstack/svelte-query-persist-client 6.1.33 → 6.1.34 Dependent
@tanstack/vue-query 5.100.14 → 5.100.15 Dependent
@tanstack/vue-query-devtools 6.1.33 → 6.1.34 Dependent

@sukvvon sukvvon self-assigned this May 25, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 25, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 72bf83e

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 25, 2026

size-limit report 📦

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

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