Skip to content

fix(query-devtools/PiPContext): reset 'pip_open' in 'localStore' from 'closePipWindow' so the auto-open createEffect does not reopen the window after a programmatic close#10813

Open
sukvvon wants to merge 1 commit into
mainfrom
fix/query-devtools-close-pip-window-localstorage
Open

fix(query-devtools/PiPContext): reset 'pip_open' in 'localStore' from 'closePipWindow' so the auto-open createEffect does not reopen the window after a programmatic close#10813
sukvvon wants to merge 1 commit into
mainfrom
fix/query-devtools-close-pip-window-localstorage

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented May 28, 2026

🎯 Changes

PiPContext exposes two paths that close the PiP window:

  • The pagehide listener installed inside requestPipWindow — fires when the user closes the popup from the browser/OS chrome. It writes pip_open = 'false' to localStore and resets the pipWindow signal.
  • The public closePipWindow returned from usePiPWindow() — for callers that need to close the popup programmatically. Until this change it only reset the pipWindow signal, leaving pip_open as 'true' in localStore.

The asymmetry is observable on the next mount: the auto-open createEffect reads pip_open === 'true' and reopens the popup the caller just closed. The two paths describe the same intent ("the PiP window is no longer open"), so they should converge on the same cleanup.

Mirror the pagehide cleanup inside closePipWindow by writing pip_open = 'false' before clearing the signal. The added PiPContext.test.tsx case asserts that localStorage['TanstackQueryDevtools.pip_open'] flips to 'false' after closePipWindow() so the regression fails loudly if the write is dropped again.

✅ 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

Release Notes

  • Bug Fixes
    • Fixed an issue where the Picture-in-Picture window would automatically reopen after being closed. The window's closed state is now properly persisted, ensuring it remains closed until reopened by the user.

Review Change Stack

… 'closePipWindow' so the auto-open createEffect does not reopen the window after a programmatic close
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4cd3f865-2d06-4c09-b450-2368131473b8

📥 Commits

Reviewing files that changed from the base of the PR and between 3daac67 and d109f04.

📒 Files selected for processing (3)
  • .changeset/devtools-close-pip-window-localstorage.md
  • packages/query-devtools/src/__tests__/contexts/PiPContext.test.tsx
  • packages/query-devtools/src/contexts/PiPContext.tsx

📝 Walkthrough

Walkthrough

The PR fixes a Picture-in-Picture (PiP) lifecycle issue in query-devtools. When closePipWindow() is called, the function now resets the persisted pip_open localStorage flag to 'false' alongside closing the window, preventing the component's auto-open effect from immediately reopening it.

Changes

PiP Window Close State Reset

Layer / File(s) Summary
PiPContext closePipWindow localStorage reset
packages/query-devtools/src/contexts/PiPContext.tsx, packages/query-devtools/src/__tests__/contexts/PiPContext.test.tsx, .changeset/devtools-close-pip-window-localstorage.md
closePipWindow persists pip_open: 'false' to localStorage when closing the active window, and a test verifies this behavior prevents the auto-open effect from reopening a closed window. The changeset documents the fix.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • TanStack/query#10762: Adds PiP lifecycle tests in Devtools.test.tsx that assert pip_open is reset to 'false' after PiP closes, overlapping with this PR's PiPContext test coverage.
  • TanStack/query#10802: Also extends PiPContext.test.tsx to cover closePipWindow close/reset behavior while targeting the same closePipWindow logic.
  • TanStack/query#10760: Targets the same pip_open localStorage flow from the opposite direction, adding tests that assert pip_open: 'true' drives auto-opening behavior.

Suggested labels

package: query-devtools

Poem

🐰 A window that closes should stay closed, you see,
No sneaky effects bringing it back to spree!
Reset that localStorage flag, pure and clean,
The tidiest PiP close ever been! 🪟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: resetting 'pip_open' in 'localStore' from 'closePipWindow' to prevent auto-reopening.
Description check ✅ Passed The description comprehensively covers the changes with clear context, includes all required checklist items completed, and documents the changeset for release impact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/query-devtools-close-pip-window-localstorage

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 28, 2026

View your CI Pipeline Execution ↗ for commit d109f04

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

☁️ Nx Cloud last updated this comment at 2026-05-28 03:05:01 UTC

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

2 package(s) bumped directly, 23 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/lit-query 0.2.6 → 0.2.7 Changeset
@tanstack/query-devtools 5.100.14 → 5.100.15 Changeset
@tanstack/angular-query-experimental 5.100.14 → 5.100.15 Dependent
@tanstack/angular-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/eslint-plugin-query 5.100.14 → 5.100.15 Dependent
@tanstack/preact-query 5.100.14 → 5.100.15 Dependent
@tanstack/preact-query-devtools 5.100.14 → 5.100.15 Dependent
@tanstack/preact-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/query-async-storage-persister 5.100.14 → 5.100.15 Dependent
@tanstack/query-broadcast-client-experimental 5.100.14 → 5.100.15 Dependent
@tanstack/query-core 5.100.14 → 5.100.15 Dependent
@tanstack/query-persist-client-core 5.100.14 → 5.100.15 Dependent
@tanstack/query-sync-storage-persister 5.100.14 → 5.100.15 Dependent
@tanstack/react-query 5.100.14 → 5.100.15 Dependent
@tanstack/react-query-devtools 5.100.14 → 5.100.15 Dependent
@tanstack/react-query-next-experimental 5.100.14 → 5.100.15 Dependent
@tanstack/react-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/solid-query 5.100.14 → 5.100.15 Dependent
@tanstack/solid-query-devtools 5.100.14 → 5.100.15 Dependent
@tanstack/solid-query-persist-client 5.100.14 → 5.100.15 Dependent
@tanstack/svelte-query 6.1.33 → 6.1.34 Dependent
@tanstack/svelte-query-devtools 6.1.33 → 6.1.34 Dependent
@tanstack/svelte-query-persist-client 6.1.33 → 6.1.34 Dependent
@tanstack/vue-query 5.100.14 → 5.100.15 Dependent
@tanstack/vue-query-devtools 6.1.33 → 6.1.34 Dependent

@sukvvon sukvvon self-assigned this May 28, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 28, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/lit-query

npm i https://pkg.pr.new/@tanstack/lit-query@10813

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@10813

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@10813

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: d109f04

@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 12.11 KB (0%)
react minimal 9.08 KB (0%)

@sukvvon sukvvon requested a review from TkDodo May 28, 2026 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant