From 3faa66a1fc0d52bf0602070bb30b49e29461dc65 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Fri, 27 Oct 2023 11:21:59 -0700 Subject: [PATCH] Resizing window no longer changes sidebar visibility Fixes #4 --- src-web/components/Workspace.tsx | 13 +++---------- src-web/components/responseViewers/TextViewer.tsx | 1 + 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src-web/components/Workspace.tsx b/src-web/components/Workspace.tsx index 5d866bbc..f7051509 100644 --- a/src-web/components/Workspace.tsx +++ b/src-web/components/Workspace.tsx @@ -29,7 +29,7 @@ const drag = { gridArea: 'drag' }; export default function Workspace() { const { setWidth, width, resetWidth } = useSidebarWidth(); - const { show, hide, hidden, toggle } = useSidebarHidden(); + const { hide, hidden, toggle } = useSidebarHidden(); const windowSize = useWindowSize(); const [floating, setFloating] = useState(false); @@ -43,15 +43,8 @@ export default function Workspace() { // float/un-float sidebar on window resize useEffect(() => { const shouldHide = windowSize.width <= WINDOW_FLOATING_SIDEBAR_WIDTH; - if (shouldHide && !hidden) { - setFloating(true); - hide(); - } else if (!shouldHide && hidden) { - setFloating(false); - show(); - } - - // eslint-disable-next-line react-hooks/exhaustive-deps + if (shouldHide) setFloating(true); + else if (!shouldHide) setFloating(false); }, [windowSize.width]); const unsub = () => { diff --git a/src-web/components/responseViewers/TextViewer.tsx b/src-web/components/responseViewers/TextViewer.tsx index d69e3b47..62c2ebc3 100644 --- a/src-web/components/responseViewers/TextViewer.tsx +++ b/src-web/components/responseViewers/TextViewer.tsx @@ -1,3 +1,4 @@ +import { w } from '@tauri-apps/api/clipboard-79413165'; import { useResponseBodyText } from '../../hooks/useResponseBodyText'; import { useResponseContentType } from '../../hooks/useResponseContentType'; import { tryFormatJson } from '../../lib/formatters';