Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/devtools-close-pip-window-localstorage.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
---
'@tanstack/query-devtools': patch
---

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
Original file line numberDiff line numberDiff line change
Expand Up@@ -312,6 +312,22 @@ describe('PiPContext', () => {

expect(fakeWindow.close).toHaveBeenCalledTimes(1)
})

it('should reset "pip_open" in "localStore" so the auto-open createEffect does not reopen the window', () => {
stubPipWindow()

renderAndAct(
(pip) => {
pip().requestPipWindow(640, 480)
pip().closePipWindow()
},
{ disabled: true },
)

expect(localStorage.getItem('TanstackQueryDevtools.pip_open')).toBe(
'false',
)
})
})

describe('"pip_open" auto-open createEffect', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/query-devtools/src/contexts/PiPContext.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,6 +41,7 @@ export const PiPProvider = (props: PiPProviderProps) => {
const w = pipWindow()
if (w != null) {
w.close()
props.setLocalStore('pip_open', 'false')
setPipWindow(null)
}
}
Expand Down
Loading