Prevent workspace diff sidebar layout flash

This commit is contained in:
Dotta committed 2026-05-19 14:49:42 -05:00
1 parent 3d13029336
commit 0b9539fbbf
1 file changed
+4 -2
@@ -129,14 +129,16 @@ function writeStoredFileSidebarWidth(width: number) {
}
function useIsDesktopDiffLayout() {
const [isDesktop, setIsDesktop] = useState(false);
const [isDesktop, setIsDesktop] = useState(() => {
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return false;
return window.matchMedia("(min-width: 1024px)").matches;
});
useEffect(() => {
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
const query = window.matchMedia("(min-width: 1024px)");
const update = () => setIsDesktop(query.matches);
update();
query.addEventListener("change", update);
return () => query.removeEventListener("change", update);
}, []);