Skip to content

Commit

Permalink
Fix: remember the prior position on horizontal splitter toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
insmac committed Nov 10, 2023
1 parent 2e785fa commit 451bcdb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/web-console/src/scenes/Console/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ const Console = () => {
const { sm } = useScreenSize()
const { editorSplitterBasis, resultsSplitterBasis, updateSettings } =
useLocalStorage()
const [savedResultsSplitterBasis, setSavedResultsSplitterBasis] =
useState(resultsSplitterBasis)
const result = useSelector(selectors.query.getResult)
const activeBottomPanel = useSelector(selectors.console.getActiveBottomPanel)
const { readOnly } = useSelector(selectors.console.getConfig)
Expand Down Expand Up @@ -133,7 +135,9 @@ const Console = () => {
)
updateSettings(
StoreKey.RESULTS_SPLITTER_BASIS,
resultsSplitterBasis === 0 ? 300 : 0,
resultsSplitterBasis === 0
? savedResultsSplitterBasis
: 0,
)
}}
selected={resultsSplitterBasis !== 0}
Expand All @@ -151,6 +155,7 @@ const Console = () => {
<Allotment
ref={horizontalSplitterRef}
onDragEnd={(sizes) => {
setSavedResultsSplitterBasis(sizes[0])
updateSettings(StoreKey.RESULTS_SPLITTER_BASIS, sizes[0])
}}
snap
Expand Down

0 comments on commit 451bcdb

Please sign in to comment.