mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Give useIsMobile an initial state
This commit is contained in:
4 files changed
+20
-39
No files matched your search
@@ -27,14 +27,7 @@ export function AppLayout({
|
||||
const navigate = useNavigate();
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
const [isSidebarVisible, setIsSidebarVisible] = useState(() => {
|
||||
// On mobile, always start hidden
|
||||
if (typeof window !== 'undefined' && window.innerWidth < 768) {
|
||||
return false;
|
||||
}
|
||||
// On desktop, we'll set the initial state after projects load
|
||||
return false; // Default to closed initially
|
||||
});
|
||||
const [isSidebarVisible, setIsSidebarVisible] = useState(!isMobile);
|
||||
|
||||
// Track if we've set the initial state based on projects
|
||||
const [hasSetInitialState, setHasSetInitialState] = useState(false);
|
||||
|
||||
Reference in new issue
Block a user