Don't auto-close drawer when window isnt loaded (#827)

Summary:
This was triggering frequently for me, auto-closing my ISL after I closed the sidebar and reopened it later.

This case seems irrelevant and likely indicative that the frame just isnt loaded yet, so just skipping the autoclose.

https://github.com/facebook/sapling/issues/768

Pull Request resolved: https://github.com/facebook/sapling/pull/827

Reviewed By: evangrayk

Differential Revision: D53138052

fbshipit-source-id: 1a548019652da481effeec0f054dab6947855dc4
This commit is contained in:
Alex Coleman 2024-02-23 13:25:50 -08:00 committed by Facebook GitHub Bot
parent 6d2a9bede4
commit fa68f75f79

View File

@ -27,6 +27,10 @@ export const islDrawerState = localStorageBackedAtom<AllDrawersState>('isl.drawe
// This allows collapsing even if the size has been previous persisted.
function autoCloseBasedOnWindowWidth() {
const windowWidth = getWindowWidthInPixels();
if (windowWidth === 0) {
// window not loaded yet
return;
}
const current = readAtom(islDrawerState).right.size;
const setDrawer = (state: DrawerState) => {