Resizing window no longer changes sidebar visibility

Fixes #4
This commit is contained in:
Gregory Schier
2023-10-27 11:21:59 -07:00
parent ccb04f0b45
commit d0e2220df7
2 changed files with 4 additions and 10 deletions

View File

@@ -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<boolean>(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 = () => {

View File

@@ -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';