Repository navigation
fix(angular-query-experimental/{withDevtools,injectDevtoolsPanel}): load the devtools only once when options change while loading, and create them with the latest options - #12322
Conversation
…oad the devtools only once when options change while loading, and create them with the latest options
🦋 Changeset detectedLatest commit: eea8725 The changes in this PR will be included in the next version bump. This PR includes changesets to release 24 packages
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 |
|
View your CI Pipeline Execution ↗ for commit eea8725
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview5 package(s) bumped directly, 19 bumped as dependents. 🟨 Minor bumps
🟩 Patch bumps
|
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
| Layer / File(s) | Summary |
|---|---|
Panel import and mount .changeset/angular-devtools-load-once.md, packages/angular-query-experimental/src/devtools-panel/inject-devtools-panel.ts, packages/angular-query-experimental/src/__tests__/inject-devtools-panel.test.ts |
The panel effect stores the pending import and loaded class, then creates and mounts the panel. Tests cover updated theme options and host-element or injector removal during loading. |
withDevtools import and mount packages/angular-query-experimental/src/devtools/with-devtools.ts, packages/angular-query-experimental/src/__tests__/with-devtools.test.ts |
The effect stores the pending import and loaded class, then creates and mounts devtools. Tests cover updated options, disabling during loading, missing-client behavior, and existing asynchronous lifecycle cases. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Possibly related PRs
- TanStack/query#12316: Adds the panel theme option and forwards it to the constructor; this change tests that the loaded panel uses the latest theme.
Suggested reviewers: arnoud-dv
Merge Risk: 
Minimal · up to 37299
-
The reported loading and cancellation behavior leaves no identified merge-blocking issue; proceed with normal checks.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
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 4 files. (1 skipped: 1 unsupported.)
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Comment @coderabbitai help to get the list of available commands.
size-limit report 📦
|
🎯 Changes
withDevtoolsandinjectDevtoolsPanelstartimport('@tanstack/query-devtools')inside aneffectwhenever no devtools instance exists yet. If the options change before that import resolves, the effect runs again and starts a second import, so two devtools instances are created and mounted. The first one is overwritten and never unmounted.injectDevtoolsPanelalso creates the panel with the options captured before loading.Both now store the loaded devtools class in a signal and create the instance inside the
effect:effectruns again and creates the devtools with the current options.hostElementis removed,loadDevtoolsbecomesfalse, or the injector is destroyed while loading, nothing is created. This replaces theinjectorIsDestroyedflag inwithDevtools.Behavior changes:
withDevtoolswithout aQueryClientnow throwsNo QueryClient foundfrom theeffect, likeinjectDevtoolsPanel. It was previously caught and logged together with the "Install @tanstack/query-devtools" message.Tests were added for options changing while loading, for the
hostElementbeing removed and the injector being destroyed while loading (injectDevtoolsPanel), and forloadDevtoolsbecomingfalsewhile loading (withDevtools). Existing tests now flush effects withTestBed.tick()after the import settles.✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.🚀 Release Impact
Summary by CodeRabbit