feat(angular-query): add devtools theme option #10609
main fromrefs/pull/10609/head·merged by TkDodo View on GitHub🎯 Changes#
Add theme option support to Angular floating devtools.
React, Vue, and Solid devtools already expose the shared theme?: Theme option. This adds the same option to Angular floating devtools and updates an existing devtools instance with setTheme(theme) when the option changes.
This keeps Angular devtools aligned with the shared query devtools API and sibling framework bindings.
✅ 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#
- New Features
- Added theme option support to the Angular floating devtools, enabling light, dark, or system theme selection for the devtools panel. The theme can be applied dynamically to existing devtools instances and is respected on initial load; when unspecified it defaults to the system preference.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: angular-query-experimental
View your CI Pipeline Execution ↗ for commit 2a924f5dcc00bb3b41dc3bc6878e8e75b031de2e
Command Status Duration Result nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded 2m 30s View ↗ nx run-many --target=build --exclude=examples/*...✅ Succeeded <1s View ↗
☁️ Nx Cloud last updated this comment at
2026-05-03 14:09:49UTCMore templates
- @tanstack/query-example-preact-simple
- @tanstack/query-example-angular-auto-refetching
- @tanstack/query-example-angular-basic
- @tanstack/query-example-angular-basic-persister
- @tanstack/query-example-angular-devtools-panel
- @tanstack/query-example-angular-infinite-query-with-max-pages
- @tanstack/query-example-angular-optimistic-updates
- @tanstack/query-example-angular-pagination
- @tanstack/query-example-angular-query-options-from-a-service
- @tanstack/query-example-angular-router
- @tanstack/query-example-angular-rxjs
- @tanstack/query-example-angular-simple
- @tanstack/query-example-solid-astro
- @tanstack/query-example-solid-basic
- @tanstack/query-example-solid-basic-graphql-request
- @tanstack/query-example-solid-default-query-function
- @tanstack/query-example-solid-offline
- @tanstack/query-example-solid-simple
- @tanstack/query-example-solid-start-streaming
- @tanstack/query-example-svelte-auto-refetching
- @tanstack/query-example-svelte-basic
- @tanstack/query-example-svelte-load-more-infinite-scroll
- @tanstack/query-example-svelte-optimistic-updates
- @tanstack/query-example-svelte-playground
- @tanstack/query-example-svelte-simple
- @tanstack/query-example-svelte-ssr
- @tanstack/query-example-svelte-star-wars
- @tanstack/query-example-react-algolia
- @tanstack/query-example-react-auto-refetching
- @tanstack/query-example-react-basic
- @tanstack/query-example-react-basic-graphql-request
- @tanstack/query-example-chat
- @tanstack/query-example-react-default-query-function
- @tanstack/query-example-react-devtools-panel
- @tanstack/query-example-eslint-legacy
- @tanstack/query-example-eslint-plugin-demo
- @tanstack/query-example-react-infinite-query-with-max-pages
- @tanstack/query-example-react-load-more-infinite-scroll
- @tanstack/query-example-react-nextjs
- @tanstack/query-example-react-nextjs-app-prefetching
- @tanstack/query-example-nextjs-suspense-streaming
- @tanstack/query-example-react-offline
- @tanstack/query-example-react-optimistic-updates-cache
- @tanstack/query-example-react-optimistic-updates-ui
- @tanstack/query-example-react-pagination
- @tanstack/query-example-react-playground
- @tanstack/query-example-react-prefetching
- @tanstack/query-example-react-react-native
- @tanstack/query-example-react-router
- @tanstack/query-example-react-rick-morty
- @tanstack/query-example-react-shadow-dom
- @tanstack/query-example-react-simple
- @tanstack/query-example-react-star-wars
- @tanstack/query-example-react-suspense
- @tanstack/query-example-vue-2.6-basic
- @tanstack/query-example-vue-2.7-basic
- @tanstack/query-example-vue-basic
- @tanstack/query-example-vue-dependent-queries
- @tanstack/query-example-vue-nuxt3
- @tanstack/query-example-vue-persister
- @tanstack/query-example-vue-simple
@tanstack/angular-query-experimental
npm i https://pkg.pr.new/@tanstack/angular-query-experimental@10609@tanstack/eslint-plugin-query
npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@10609@tanstack/preact-query
npm i https://pkg.pr.new/@tanstack/preact-query@10609@tanstack/preact-query-devtools
npm i https://pkg.pr.new/@tanstack/preact-query-devtools@10609@tanstack/preact-query-persist-client
npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@10609@tanstack/query-async-storage-persister
npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@10609@tanstack/query-broadcast-client-experimental
npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@10609@tanstack/query-core
npm i https://pkg.pr.new/@tanstack/query-core@10609@tanstack/query-devtools
npm i https://pkg.pr.new/@tanstack/query-devtools@10609@tanstack/query-persist-client-core
npm i https://pkg.pr.new/@tanstack/query-persist-client-core@10609@tanstack/query-sync-storage-persister
npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@10609@tanstack/react-query
npm i https://pkg.pr.new/@tanstack/react-query@10609@tanstack/react-query-devtools
npm i https://pkg.pr.new/@tanstack/react-query-devtools@10609@tanstack/react-query-next-experimental
npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@10609@tanstack/react-query-persist-client
npm i https://pkg.pr.new/@tanstack/react-query-persist-client@10609@tanstack/solid-query
npm i https://pkg.pr.new/@tanstack/solid-query@10609@tanstack/solid-query-devtools
npm i https://pkg.pr.new/@tanstack/solid-query-devtools@10609@tanstack/solid-query-persist-client
npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@10609@tanstack/svelte-query
npm i https://pkg.pr.new/@tanstack/svelte-query@10609@tanstack/svelte-query-devtools
npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@10609@tanstack/svelte-query-persist-client
npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@10609@tanstack/vue-query
npm i https://pkg.pr.new/@tanstack/vue-query@10609@tanstack/vue-query-devtools
npm i https://pkg.pr.new/@tanstack/vue-query-devtools@10609commit:
2a924f5Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/angular-query-experimental/src/devtools/with-devtools.ts (1)
138-147: ⚠️ Potential issue | 🟡 MinorRemove the truthy guard when syncing
themeupdates.On line 146, the
if (theme)guard prevents updates whenthemebecomesundefined, so an existing instance retains stale theme instead of resetting to default. React and Preact implementations callsetTheme()directly without guards, and the method signature accepts optional values. Removing the guard aligns with other frameworks and allows proper synchronization when the option is removed.Suggested fix
- if (theme) devtools.setTheme(theme) + devtools.setTheme(theme)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/angular-query-experimental/src/devtools/with-devtools.ts` around lines 138 - 147, The theme update guard prevents clearing a previously set theme; instead of conditionally calling devtools.setTheme only when theme is truthy, always call devtools.setTheme(theme) in the same update block so undefined resets to default; update the code in with-devtools.ts where devtools is updated (the block that calls client && devtools.setClient(...), position && devtools.setPosition(...), etc.) to remove the if (theme) check and invoke devtools.setTheme(theme) unconditionally.🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed. Outside diff comments: In `@packages/angular-query-experimental/src/devtools/with-devtools.ts`: - Around line 138-147: The theme update guard prevents clearing a previously set theme; instead of conditionally calling devtools.setTheme only when theme is truthy, always call devtools.setTheme(theme) in the same update block so undefined resets to default; update the code in with-devtools.ts where devtools is updated (the block that calls client && devtools.setClient(...), position && devtools.setPosition(...), etc.) to remove the if (theme) check and invoke devtools.setTheme(theme) unconditionally.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID:
9aecca21-4e5e-4db4-9062-902bd73e6a72📥 Commits
Reviewing files that changed from the base of the PR and between c5ab5a1065ebb6a2a6e2802f974df10b527c1db9 and feb8b3ff006761c1a689f463c219d146b4020788.
📒 Files selected for processing (3)
.changeset/angular-devtools-theme-option.mdpackages/angular-query-experimental/src/devtools/types.tspackages/angular-query-experimental/src/devtools/with-devtools.ts
TkDodo reviewed
packages/angular-query-experimental/src/devtools/with-devtools.ts line 146OutdatedResolvedby grzdev(GitHub profile, opens in a new tab)@@ -142,3 +143,4 @@142143 buttonPosition && devtools.setButtonPosition(buttonPosition)143144 typeof initialIsOpen === 'boolean' &&144145 devtools.setInitialIsOpen(initialIsOpen)146+ if (theme) devtools.setTheme(theme)should probably keep the same pattern here:
theme && devtools.setTheme(theme)updated, thanks 👍
TkDodo merged thisbf902df
TkDodo closed this
Sign in to join this conversation.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID:
c60ace12-612a-4f39-a33a-0ebf13dd3a19📥 Commits
Reviewing files that changed from the base of the PR and between feb8b3ff006761c1a689f463c219d146b4020788 and 2a924f5dcc00bb3b41dc3bc6878e8e75b031de2e.
📒 Files selected for processing (1)
packages/angular-query-experimental/src/devtools/with-devtools.ts🚧 Files skipped from review as they are similar to previous changes (1)
📝 Walkthrough
Walkthrough#
Theme option support is added to Angular floating devtools. The
DevtoolsOptionsinterface gains an optionalthemeproperty, and the devtools update flow now reads this option and callssetTheme()on existing devtools instances.Changes#
Theme option support
packages/angular-query-experimental/src/devtools/types.tstheme?: Themeto exportedDevtoolsOptions.packages/angular-query-experimental/src/devtools/with-devtools.tsthemefromdevtoolsOptions()in the devtools update effect and, when truthy and an instance exists, calldevtools.setTheme(theme)..changeset/angular-devtools-theme-option.mdEstimated code review effort#
🎯 2 (Simple) | ⏱️ ~10 minutes
Poem#
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip
💬 Introducing Slack Agent: The best way for teams to turn conversations into code.
Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack.
👉 Get started
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