Skip to content

test(preact-query-devtools): add test for creating the devtools instance only once across re-renders - #11723

Merged
sukvvon merged 1 commit into
mainfrom
test/preact-query-devtools-single-instance
Sep 29, 2026
Merged

sukvvon merged 1 commit into
mainfrom
test/preact-query-devtools-single-instance

Conversation

@sukvvon

@sukvvon sukvvon commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

🎯 Changes

  • Add a test to PreactQueryDevtools and PreactQueryDevtoolsPanel that re-renders the component and asserts the devtools constructor (TanstackQueryDevtools / TanstackQueryDevtoolsPanel) is called only once.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm run test:pr, or these tests do not apply to this pull request.
  • I have followed the AI contribution policy and fully understand the code in this pull request, including any code generated with AI assistance.

🚀 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 coverage confirming that changing the devtools position or rerendering with the same client and error types does not create additional devtools instances. This helps ensure the devtools behave consistently across these rerenders.

@sukvvon sukvvon self-assigned this Sep 29, 2026
@nx-cloud

nx-cloud Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 24f5b5a

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

☁️ Nx Cloud last updated this comment at 2026-09-29 01:52:07 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: TanStack/query/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: db1f2183-dd66-46ec-9aae-453772598cda

📥 Commits

Reviewing files that changed from the base of the PR and between d99c84b and 24f5b5a.

📒 Files selected for processing (2)
  • packages/preact-query-devtools/src/__tests__/PreactQueryDevtools.test.tsx
  • packages/preact-query-devtools/src/__tests__/PreactQueryDevtoolsPanel.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The pull request adds tests for devtools constructor counts after rerendering PreactQueryDevtools and PreactQueryDevtoolsPanel.

Changes

Preact devtools rerender tests

Layer / File(s) Summary
Constructor stability checks
packages/preact-query-devtools/src/__tests__/PreactQueryDevtools.test.tsx, packages/preact-query-devtools/src/__tests__/PreactQueryDevtoolsPanel.test.tsx
The tests assert that the devtools constructor is called once after changing position and after rerendering the panel with unchanged props.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to 24f5b

This change adds regression tests for devtools instance stability without changing production behavior. No material merge risk was identified.

Architecture Summary

Architecture risk: 🔵 Low · up to 24f5b

The change affects 1 system.

Changed systems: packages/preact-query-devtools

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — packages/preact-query-devtools (library) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in packages/preact-query-devtools/src/tests/PreactQueryDevtools.test.tsx: Adds a rerender test that changes position from "bottom" to "top" and expects the devtools constructor to be called once.
  • observed — Modified behavior in packages/preact-query-devtools/src/tests/PreactQueryDevtoolsPanel.test.tsx: Added a rerender test asserting that TanstackQueryDevtoolsPanel is constructed once across the initial render and a subsequent render with the same props.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: tests that verify devtools instances are created only once across re-renders.
Description check ✅ Passed The description includes all required sections. It explains the test changes, completes the checklist, and identifies the change as dev-only with no release impact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
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.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@pkg-pr-new

pkg-pr-new Bot commented Sep 29, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 24f5b5a

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 11.73 KB (0%)
react minimal 8.58 KB (0%)

@sukvvon
sukvvon merged commit 31dc60f into main Sep 29, 2026
9 checks passed
@sukvvon
sukvvon deleted the test/preact-query-devtools-single-instance branch September 29, 2026 02:14
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