fix(devtools): respect URL gating for the modal host #580
main fromrefs/pull/580/head·opened View on GitHub🎯 Changes#
With openAsModal and requireUrlFlag enabled, the modal host could open over an application dialog even when the URL flag hid the devtools panel. The resulting empty modal made the application dialog inert.
Use the panel's existing URL visibility condition for the modal host as well. The condition still allows the panel in Picture-in-Picture.
Add a Playwright regression that starts with defaultOpen, omits the required URL flag, and clicks a button in the application dialog while the devtools panel is absent.
✅ Checklist#
- I have followed the steps in the Contributing guide.
- I have tested code changes locally with
pnpm test:pr, or these tests do not apply to this pull request. - I fully understand the code in this pull request, including any code generated with AI assistance.
pnpm test:pr passes. The new Playwright test in e2e/apps/react-vite/tests/open-as-modal.spec.ts fails on main (the click on the app dialog button times out because the dialog is inert) and passes with this change, together with the rest of that spec.
🚀 Release Impact#
- This change affects published code, and I have generated a changeset.
- This change is docs/CI/dev-only (no release).
AI assistance was used to prepare the patch and regression test.
Summary by CodeRabbit#
- Bug Fixes
- Fixed modal behavior when a required URL flag hides the Devtools panel. App dialogs remain interactive, and their buttons can still be clicked and focused.
- The modal no longer blocks interaction with the app when the panel is not visible.
- 1
tanstack-source added labelsbug
No actionable comments were generated in the recent review.
Walkthrough
-
The modal host now renders only when modal mode is enabled and the Devtools panel is visible. The React Vite test app supports a URL-controlled default-open setting, and an end-to-end test checks app-dialog interaction when the gated panel is hidden.
Changes: Modal visibility gating
Layer / File(s) Summary Gate the modal host on panel visibility
packages/devtools/src/devtools.tsxA shared visibility check covers PiP, URL-flag enforcement, and the current query string. The modal host and panel render condition use this check. Configure and test the gated modal case
e2e/apps/react-vite/src/main.tsx,e2e/apps/react-vite/tests/open-as-modal.spec.ts,.changeset/quiet-dialog-flag.mdThe test app sets defaultOpenfrom the URL. The end-to-end test checks that the panel is absent and the app-dialog button remains clickable and focused. A patch changeset records the change.Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related PRs
- TanStack/devtools#550: Adds the modal host and
openAsModaloption that this change updates to account for panel visibility.
Suggested reviewers:
alemtuzlak - TanStack/devtools#550: Adds the modal host and
Merge Risk:
Minimal · up toa72c3-
This change stops an empty modal host from making an application dialog inert when the required URL flag is missing. It is a small, localized fix with a regression test, and no merge-blocking risk was identified.
Pre-merge checks:
4-
Check name Status Explanation Title check The title names the main change: the modal host now respects the URL gating that the panel already uses. It matches the changeset, the devtools.tsx change, and the regression test. The title follows t… Description check The description follows the template. It has the Changes section explaining the bug, the fix, and the Playwright regression. The checklist items are marked, and the Release Impact section is filled in… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Title check
-
Explanation
The title names the main change: the modal host now respects the URL gating that the panel already uses. It matches the changeset, the devtools.tsx change, and the regression test. The title follows the conventional fix(scope) form, is 8 words, and avoids vague terms.
Full details: Description check
-
Explanation
The description follows the template. It has the Changes section explaining the bug, the fix, and the Playwright regression. The checklist items are marked, and the Release Impact section is filled in with a changeset noted. The first checklist item and the AI-understanding item are left partly unverified, but the description is mostly complete.
-
Finishing Touches
-
Generate unit tests (beta)
-
- 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.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: TanStack/devtools
- Branch: main
- File: .coderabbit.yaml
- Commit: 1ff6734
- Layers: Repository YAML
- Review profile: CHILL
- Plan: Advanced
- Run ID:
ff031a32-becc-4411-8fbd-18b6aeb1bfa9
Commits-
Reviewing files that changed from the base of the PR and between 1ff67341c1c28af3ce2ae3522e44064f08fea785 and a72c305bde49dbb9024698f16043509ca9ecd784.
Files selected for processing: 4-
.changeset/quiet-dialog-flag.mde2e/apps/react-vite/src/main.tsxe2e/apps/react-vite/tests/open-as-modal.spec.tspackages/devtools/src/devtools.tsx
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
-
-
Sign in to join this conversation.
🦋 Changeset detected#
Latest commit: a72c305bde49dbb9024698f16043509ca9ecd784
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 11 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