Skip to content

test(query-devtools/TanstackQueryDevtoolsPanel): add 'mount' and 'unmount' lifecycle tests#10640

Merged
sukvvon merged 1 commit intomainfrom
test/query-devtools-panel-lifecycle
May 5, 2026
Merged

test(query-devtools/TanstackQueryDevtoolsPanel): add 'mount' and 'unmount' lifecycle tests#10640
sukvvon merged 1 commit intomainfrom
test/query-devtools-panel-lifecycle

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented May 5, 2026

🎯 Changes

Add the first lifecycle tests for the TanstackQueryDevtoolsPanel core class, following the pattern established in #10639.

  • Add src/__tests__/TanstackQueryDevtoolsPanel.test.tsx with 5 cases covering mount/unmount lifecycle and guard behavior:
    • mount: succeeds on a provided element / throws on double mount
    • unmount: allows remounting / throws when called before mount / throws on double unmount

Setter contract and reactive UI behavior are intentionally out of scope for this PR — they will be covered in follow-up PRs.

✅ 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 comprehensive test coverage for Query Devtools panel initialization and lifecycle management, including mount/unmount behavior validation.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 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: 1579b06a-fb2f-4c35-b92d-eafd2bd57450

📥 Commits

Reviewing files that changed from the base of the PR and between 5892279 and dcfd50f.

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

📝 Walkthrough

Walkthrough

A new Vitest test suite for TanstackQueryDevtoolsPanel is added. Tests verify that the panel mounts and unmounts without error, and correctly throws exceptions when mount is called twice or unmount is called before mount.

Changes

TanstackQueryDevtoolsPanel Test Suite

Layer / File(s) Summary
Tests
packages/query-devtools/src/__tests__/TanstackQueryDevtoolsPanel.test.tsx
New Vitest test suite covering mount/unmount lifecycle with error state validation for duplicate mounts and invalid unmounts.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

package: query-devtools

Poem

🐰 A test suite springs to life today,
Checking mounts and unmounts stay in place,
Errors caught before they astray,
The devtools panel finds its grace! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding lifecycle tests for mount and unmount behavior in TanstackQueryDevtoolsPanel.
Description check ✅ Passed The description comprehensively covers all required sections from the template: Changes with specific test cases and scope limitations, completed checklist items, and correct Release Impact designation.
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-devtools-panel-lifecycle

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

@sukvvon sukvvon self-assigned this May 5, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 5, 2026

View your CI Pipeline Execution ↗ for commit dcfd50f

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

☁️ Nx Cloud last updated this comment at 2026-05-05 12:46:28 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 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 May 5, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: dcfd50f

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

size-limit report 📦

Path Size
react full 12.1 KB (0%)
react minimal 9.07 KB (0%)

@sukvvon sukvvon merged commit 0d8d64b into main May 5, 2026
10 checks passed
@sukvvon sukvvon deleted the test/query-devtools-panel-lifecycle branch May 5, 2026 12:55
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