Skip to content

feat(angular-query): move devtools to conditional sub-paths #9270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

arnoud-dv
Copy link
Collaborator

Breaking changes

Import paths

withDevtools moved to subpath

Most applications, to completely tree shake devtools from production builds

import { withDevtools } from '@tanstack/angular-query-experimental/devtools'

If you want to also use devtools in production builds

import { withDevtools } from '@tanstack/angular-query-experimental/devtools/production'

injectDevtoolsPanel moved to main package

Most applications, to completely tree shake devtools panel from production builds

import { injectDevtoolsPanel } from '@tanstack/angular-query-experimental/devtools-panel'

If you want to also use devtools panel in production builds

import { injectDevtoolsPanel } from '@tanstack/angular-query-experimental/devtools-panel/production'

angular-query-devtools-experimental package

After moving injectDevtoolsPanel to the main package, the angular devtools package is obsolete.

Improvements and fixes

Subpath exports

Experience with subpath exports paves the way to add functionality such as RxJs integration without needing to have the whole Angular TanStack Query package depend on RxJs.

Isolating devtools to a subpath reliably fixes #9078, where esbuild was generating chunks even when devtools were not used at all. While these chunks were not adding to the main bundle size it unnecessarily increased build time and deployment size.

Conditional exports

The devtools subpath exports further utilize conditional exports. For development builds, the function is exported normally. For production builds a tiny stub function is exported, resulting in excellent tree shaking without having to configure environments.

Dependency injection in the devtools callback

Fixes #8824 After no longer running the options computation function in the injection context it was no longer possible to use dependency injection to inject values. The withDevtools function now has a deps option to automatically inject dependencies and pass it as a parameter to the computation function. This solves this issue while not injecting a value each time the computation function is run which would be the case if the function would run in the injection context. This is similar to and internally uses deps on Angular's useFactory.

withDevtools(
  (devToolsOptionsManager: DevtoolsOptionsManager) => ({
    loadDevtools: devToolsOptionsManager.loadDevtools(),
  }),
  {
    // `deps` is used to inject and pass `DevtoolsOptionsManager` to the `withDevtools` callback.
    deps: [DevtoolsOptionsManager],
  },
)

Adds a check if devtools were already provided

Fixes #8705

Copy link

nx-cloud bot commented Jun 11, 2025

View your CI Pipeline Execution ↗ for commit d6f6fa3.

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

☁️ Nx Cloud last updated this comment at 2025-06-17 20:10:35 UTC

Copy link

codecov bot commented Jun 11, 2025

Codecov Report

Attention: Patch coverage is 95.52239% with 3 lines in your changes missing coverage. Please review.

Project coverage is 45.61%. Comparing base (1c7c276) to head (695d33a).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #9270      +/-   ##
==========================================
+ Coverage   45.37%   45.61%   +0.24%     
==========================================
  Files         207      211       +4     
  Lines        8276     8317      +41     
  Branches     1862     1873      +11     
==========================================
+ Hits         3755     3794      +39     
- Misses       4080     4082       +2     
  Partials      441      441              
Components Coverage Δ
@tanstack/angular-query-experimental 86.21% <95.52%> (+1.21%) ⬆️
@tanstack/eslint-plugin-query 83.24% <ø> (ø)
@tanstack/query-async-storage-persister 43.85% <ø> (ø)
@tanstack/query-broadcast-client-experimental 24.39% <ø> (ø)
@tanstack/query-codemods 0.00% <ø> (ø)
@tanstack/query-core 98.15% <ø> (ø)
@tanstack/query-devtools 3.55% <ø> (ø)
@tanstack/query-persist-client-core 79.47% <ø> (ø)
@tanstack/query-sync-storage-persister 84.61% <ø> (ø)
@tanstack/query-test-utils 77.77% <ø> (ø)
@tanstack/react-query 95.93% <ø> (ø)
@tanstack/react-query-devtools 10.00% <ø> (ø)
@tanstack/react-query-next-experimental ∅ <ø> (∅)
@tanstack/react-query-persist-client 100.00% <ø> (ø)
@tanstack/solid-query 78.13% <ø> (ø)
@tanstack/solid-query-devtools ∅ <ø> (∅)
@tanstack/solid-query-persist-client 100.00% <ø> (ø)
@tanstack/svelte-query 88.07% <ø> (ø)
@tanstack/svelte-query-devtools ∅ <ø> (∅)
@tanstack/svelte-query-persist-client 100.00% <ø> (ø)
@tanstack/vue-query 71.10% <ø> (ø)
@tanstack/vue-query-devtools ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

… improves tree shaking and dependency injection
@arnoud-dv arnoud-dv force-pushed the feature/angular-query-devtools-sub-path-imports branch from 2cf432d to cd70269 Compare June 11, 2025 21:37
Copy link

pkg-pr-new bot commented Jun 11, 2025

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: d6f6fa3

arnoud-dv and others added 5 commits June 12, 2025 16:05
…ry-devtools-sub-path-imports

# Conflicts:
#	examples/angular/devtools-panel/package.json
#	packages/angular-query-devtools-experimental/package.json
…hub.com:arnoud-dv/query into feature/angular-query-devtools-sub-path-imports
@arnoud-dv arnoud-dv force-pushed the feature/angular-query-devtools-sub-path-imports branch 4 times, most recently from c2ebe03 to b724764 Compare June 12, 2025 16:08
@arnoud-dv arnoud-dv force-pushed the feature/angular-query-devtools-sub-path-imports branch from b724764 to e9055fb Compare June 12, 2025 18:26
@arnoud-dv arnoud-dv force-pushed the feature/angular-query-devtools-sub-path-imports branch from 053d604 to c2600eb Compare June 17, 2025 19:30
@arnoud-dv arnoud-dv force-pushed the feature/angular-query-devtools-sub-path-imports branch from 695d33a to d6f6fa3 Compare June 17, 2025 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant