From a7f410b75b991543e67514b158ce8cf40a65d357 Mon Sep 17 00:00:00 2001 From: Caroline Denis Date: Mon, 5 Oct 2026 10:02:10 +0200 Subject: [PATCH] Fix (Split View): Use full width after split view is hidden --- .../lib/components/QueryBuilder/SplitView.tsx | 9 ++++-- .../QueryBuilder/__tests__/SplitView.test.tsx | 28 +++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/specifyweb/frontend/js_src/lib/components/QueryBuilder/SplitView.tsx b/specifyweb/frontend/js_src/lib/components/QueryBuilder/SplitView.tsx index 01e9057f685..97866f65703 100644 --- a/specifyweb/frontend/js_src/lib/components/QueryBuilder/SplitView.tsx +++ b/specifyweb/frontend/js_src/lib/components/QueryBuilder/SplitView.tsx @@ -77,11 +77,16 @@ export function SplitView({ null ); const previousIsHorizontal = React.useRef(isHorizontal); + const previousIsSplit = React.useRef(isSplit); React.useLayoutEffect(() => { - if (previousIsHorizontal.current !== isHorizontal) + if ( + previousIsHorizontal.current !== isHorizontal || + (previousIsSplit.current && !isSplit) + ) splitterRef.current?.setState({ primaryPane: undefined }); previousIsHorizontal.current = isHorizontal; - }, [isHorizontal]); + previousIsSplit.current = isSplit; + }, [isHorizontal, isSplit]); return ( ; const secondaryPane =
; test('clears the dragged pane size when the orientation changes', () => { + mockSetState.mockClear(); const { rerender } = render( { ); expect(mockSetState).toHaveBeenCalledWith({ primaryPane: undefined }); }); + +test('clears the dragged pane size when the split view is hidden', () => { + mockSetState.mockClear(); + const { rerender } = render( + + ); + expect(mockSetState).not.toHaveBeenCalled(); + + rerender( + + ); + expect(mockSetState).toHaveBeenCalledWith({ primaryPane: undefined }); +});