Skip to content

Commit b60ee0e

Browse files
committed
fix(devtools): remember panel height
1 parent cc58b7f commit b60ee0e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/devtools/devtools.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ export function ReactQueryDevtools({
102102
'reactQueryDevtoolsOpen',
103103
initialIsOpen
104104
)
105+
const [devtoolsHeight, setDevtoolsHeight] = useLocalStorage(
106+
'reactQueryDevtoolsHeight',
107+
null
108+
)
105109
const [isResolvedOpen, setIsResolvedOpen] = useSafeState(false)
106110
const [isResizing, setIsResizing] = useSafeState(false)
107111

@@ -119,11 +123,12 @@ export function ReactQueryDevtools({
119123
const delta = dragInfo.pageY - moveEvent.pageY
120124
const newHeight = dragInfo.originalHeight + delta
121125

126+
setDevtoolsHeight(newHeight)
127+
122128
if (newHeight < 70) {
123129
setIsOpen(false)
124130
} else {
125131
setIsOpen(true)
126-
panelElement.style.height = `${newHeight}px`
127132
}
128133
}
129134

@@ -189,7 +194,7 @@ export function ReactQueryDevtools({
189194
right: '0',
190195
zIndex: '99999',
191196
width: '100%',
192-
height: '500px',
197+
height: devtoolsHeight ?? 500,
193198
maxHeight: '90%',
194199
boxShadow: '0 0 20px rgba(0,0,0,.3)',
195200
borderTop: `1px solid ${theme.gray}`,

0 commit comments

Comments
 (0)