Skip to content
Source
Sign inSign up
TanStack/devtools

fix(devtools): respect URL gating for the modal host #580

Openpcbeingused33(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/580/headopened View on GitHub

pcbeingused33(GitHub profile, opens in a new tab)commented

🎯 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. 🦋 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
      NameType
      @tanstack/devtoolsPatch
      @tanstack/angular-devtoolsPatch
      @tanstack/preact-devtoolsPatch
      @tanstack/react-devtoolsPatch
      @tanstack/solid-devtoolsPatch
      @tanstack/svelte-devtoolsPatch
      @tanstack/vue-devtoolsPatch
      @tanstack/devtools-example-angular-a11y-devtoolsPatch
      @tanstack/devtools-example-angular-basicPatch
      @tanstack/devtools-example-angular-panelPatch
      @tanstack/devtools-example-angular-with-devtoolsPatch

      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

    2. tanstack-source added labelsbug

    3. tanstack-sourceBotcommented Only here. This is not on GitHub.

      Ready to merge: every factory step passed on a72c305.

      • audit: clean

      TanStack Source bot

    4. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Explain Change →

      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.tsx
      A 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.md
      The test app sets defaultOpen from 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 openAsModal option that this change updates to account for panel visibility.

      Suggested reviewers: alemtuzlak

      Merge Risk: Minimal · up to a72c3

      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: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe 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 checkPassedThe 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 checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck 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.

      Share

      Recent review info

      Run configuration

      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.md
      • e2e/apps/react-vite/src/main.tsx
      • e2e/apps/react-vite/tests/open-as-modal.spec.ts
      • packages/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.