Skip to content

fix(devtools): change onClose callback type from () => unknown to () …#10118

Open
grzdev wants to merge 3 commits intoTanStack:mainfrom
grzdev:fix/devtools-onclose-type
Open

fix(devtools): change onClose callback type from () => unknown to () …#10118
grzdev wants to merge 3 commits intoTanStack:mainfrom
grzdev:fix/devtools-onclose-type

Conversation

@grzdev
Copy link

@grzdev grzdev commented Feb 11, 2026

What

Changes the onClose callback type across devtools packages from:

() => unknown

to:

() => void

Why

The callback does not return a value, and void better communicates the intended usage.
This improves type clarity and developer experience across all framework bindings and docs.

Scope

  • React
  • Vue
  • Solid
  • Angular experimental
  • Query Devtools core
  • Documentation examples

No runtime changes.
Type-only improvement.

Summary by CodeRabbit

  • Documentation

    • Updated Embedded Mode options docs for React and Vue to reflect the refined onClose callback type.
  • Refactor

    • Standardized the onClose callback signature across all devtools to return no value, aligning public interfaces and ensuring consistent callback contracts.
  • Chores

    • Recorded a changeset to publish patch updates for the devtools packages.

@changeset-bot
Copy link

changeset-bot bot commented Feb 11, 2026

🦋 Changeset detected

Latest commit: 3e41e59

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@tanstack/angular-query-experimental Patch
@tanstack/query-devtools Patch
@tanstack/react-query-devtools Patch
@tanstack/solid-query-devtools Patch
@tanstack/vue-query-devtools Patch
@tanstack/angular-query-persist-client Patch
@tanstack/svelte-query-devtools Patch

Not sure what this means? Click here to learn what changesets are.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

The PR tightens the onClose callback return type from () => unknown to () => void across multiple devtools packages and docs; no runtime or control-flow changes.

Changes

Cohort / File(s) Summary
Documentation
docs/framework/react/devtools.md, docs/framework/vue/devtools.md
Updated Embedded Mode Options docs: onClose return type changed from () => unknown to () => void.
Core devtools
packages/query-devtools/src/Devtools.tsx, packages/query-devtools/src/TanstackQueryDevtoolsPanel.tsx, packages/query-devtools/src/contexts/QueryDevtoolsContext.ts
Refined onClose signatures (ContentViewProps, TanstackQueryDevtoolsPanelConfig, QueryDevtoolsProps) to () => void.
Framework-specific devtools
packages/react-query-devtools/src/ReactQueryDevtoolsPanel.tsx, packages/vue-query-devtools/src/types.ts, packages/solid-query-devtools/src/devtoolsPanel.tsx, packages/angular-query-experimental/src/devtools-panel/types.ts
Refined DevtoolsPanelOptions.onClose type from () => unknown to () => void across adapters.
Changeset
.changeset/chatty-socks-act.md
Adds changeset recording the public API change (onClose type) and patch bumps for affected packages.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • TkDodo

Poem

🐰 I hopped through types with glee and cheer,

unknown made room for tidy void here.
A gentle tweak, no runtime song,
Devtools hum as types grow strong.

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (81 files):

⚔️ .gitignore (content)
⚔️ CONTRIBUTING.md (content)
⚔️ docs/community-resources.md (content)
⚔️ docs/framework/angular/guides/caching.md (content)
⚔️ docs/framework/angular/guides/mutation-options.md (content)
⚔️ docs/framework/react/devtools.md (content)
⚔️ docs/framework/react/guides/migrating-to-v5.md (content)
⚔️ docs/framework/react/guides/prefetching.md (content)
⚔️ docs/framework/react/guides/ssr.md (content)
⚔️ docs/framework/vue/devtools.md (content)
⚔️ docs/reference/notifyManager.md (content)
⚔️ examples/react/algolia/package.json (content)
⚔️ examples/react/auto-refetching/package.json (content)
⚔️ examples/react/basic-graphql-request/package.json (content)
⚔️ examples/react/basic/package.json (content)
⚔️ examples/react/chat/package.json (content)
⚔️ examples/react/default-query-function/package.json (content)
⚔️ examples/react/devtools-panel/package.json (content)
⚔️ examples/react/eslint-legacy/package.json (content)
⚔️ examples/react/infinite-query-with-max-pages/package.json (content)
⚔️ examples/react/load-more-infinite-scroll/package.json (content)
⚔️ examples/react/nextjs-app-prefetching/.gitignore (content)
⚔️ examples/react/nextjs-app-prefetching/package.json (content)
⚔️ examples/react/nextjs-suspense-streaming/.gitignore (content)
⚔️ examples/react/nextjs-suspense-streaming/package.json (content)
⚔️ examples/react/nextjs/package.json (content)
⚔️ examples/react/offline/package.json (content)
⚔️ examples/react/optimistic-updates-cache/package.json (content)
⚔️ examples/react/optimistic-updates-ui/package.json (content)
⚔️ examples/react/pagination/package.json (content)
⚔️ examples/react/playground/package.json (content)
⚔️ examples/react/prefetching/package.json (content)
⚔️ examples/react/react-native/package.json (content)
⚔️ examples/react/react-router/package.json (content)
⚔️ examples/react/rick-morty/package.json (content)
⚔️ examples/react/shadow-dom/package.json (content)
⚔️ examples/react/simple/package.json (content)
⚔️ examples/react/star-wars/package.json (content)
⚔️ examples/react/suspense/package.json (content)
⚔️ examples/vue/basic/package.json (content)
⚔️ examples/vue/simple/package.json (content)
⚔️ integrations/react-next-14/.gitignore (content)
⚔️ integrations/react-next-15/.gitignore (content)
⚔️ integrations/react-next-16/.gitignore (content)
⚔️ labeler-config.yml (content)
⚔️ packages/angular-query-experimental/src/devtools-panel/types.ts (content)
⚔️ packages/angular-query-experimental/vite.config.ts (content)
⚔️ packages/angular-query-persist-client/vite.config.ts (content)
⚔️ packages/eslint-plugin-query/vite.config.ts (content)
⚔️ packages/preact-query/src/__tests__/useSuspenseQueries.test.tsx (content)
⚔️ packages/preact-query/vite.config.ts (content)
⚔️ packages/query-async-storage-persister/vite.config.ts (content)
⚔️ packages/query-broadcast-client-experimental/vite.config.ts (content)
⚔️ packages/query-codemods/src/v5/keep-previous-data/utils/already-has-placeholder-data-property.cjs (content)
⚔️ packages/query-core/src/__tests__/focusManager.test.tsx (content)
⚔️ packages/query-core/src/__tests__/mutations.test.tsx (content)
⚔️ packages/query-core/src/thenable.ts (content)
⚔️ packages/query-core/vite.config.ts (content)
⚔️ packages/query-devtools/src/Devtools.tsx (content)
⚔️ packages/query-devtools/src/TanstackQueryDevtoolsPanel.tsx (content)
⚔️ packages/query-devtools/src/contexts/QueryDevtoolsContext.ts (content)
⚔️ packages/query-devtools/vite.config.ts (content)
⚔️ packages/query-persist-client-core/vite.config.ts (content)
⚔️ packages/query-sync-storage-persister/vite.config.ts (content)
⚔️ packages/react-query-devtools/src/ReactQueryDevtoolsPanel.tsx (content)
⚔️ packages/react-query-devtools/vite.config.ts (content)
⚔️ packages/react-query-persist-client/vite.config.ts (content)
⚔️ packages/react-query/CHANGELOG.md (content)
⚔️ packages/react-query/package.json (content)
⚔️ packages/react-query/src/useQueries.ts (content)
⚔️ packages/react-query/vite.config.ts (content)
⚔️ packages/solid-query-devtools/src/devtoolsPanel.tsx (content)
⚔️ packages/solid-query-devtools/vite.config.ts (content)
⚔️ packages/solid-query-persist-client/vite.config.ts (content)
⚔️ packages/solid-query/vite.config.ts (content)
⚔️ packages/vue-query-devtools/CHANGELOG.md (content)
⚔️ packages/vue-query-devtools/package.json (content)
⚔️ packages/vue-query-devtools/src/types.ts (content)
⚔️ packages/vue-query/vite.config.ts (content)
⚔️ pnpm-lock.yaml (content)
⚔️ tsconfig.json (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: updating the onClose callback type from () => unknown to () => void across devtools packages.
Description check ✅ Passed The description includes a clear 'What' section explaining the type change, a 'Why' section with rationale, and a 'Scope' section listing affected packages. A changeset file has been added as required.
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
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch fix/devtools-onclose-type
  • Post resolved changes as copyable diffs in a comment

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 and usage tips.

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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/query-devtools/src/TanstackQueryDevtoolsPanel.tsx (1)

37-37: ⚠️ Potential issue | 🟡 Minor

Internal signal type still uses () => unknown, inconsistent with the public interface.

The config interface on line 21 now declares onClose?: () => void, but the private field #onClose remains Signal<(() => unknown) | undefined>. The setOnClose method on line 93 also still accepts () => unknown. Both should be updated to () => void for consistency.

Proposed fix
-  `#onClose`: Signal<(() => unknown) | undefined>
+  `#onClose`: Signal<(() => void) | undefined>

And on line 93:

-  setOnClose(onClose: () => unknown) {
+  setOnClose(onClose: () => void) {

Updated onClose callback type in devtools to improve type safety.
@TkDodo
Copy link
Collaborator

TkDodo commented Feb 16, 2026

this comment seems correct, please address it:

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

🤖 Fix all issues with AI agents
In @.changeset/chatty-socks-act.md:
- Line 9: Update the truncated changeset description in chatty-socks-act.md by
replacing the ellipsis with the full sentence describing the change:
"fix(devtools): change onClose callback type from () => unknown to () => void"
so the full context appears in release notes; ensure the top-level summary line
and body reflect this exact completed description.

@grzdev
Copy link
Author

grzdev commented Feb 16, 2026

Fixed 👍

Updated the changeset description to include the full callback signature (() => void).

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