Do not emit storage event when changing grid snapshot

To prevent unnecessary re-renders.
The current grid state was stored in the session storage which then triggered an immediate re-render because the just saved snapshot got restored again
This commit is contained in:
schroda
2024-04-16 02:49:57 +02:00
parent 1f227ce886
commit dcc90e3e2f
2 changed files with 2 additions and 2 deletions

View File

@@ -165,7 +165,7 @@ const VerticalGrid = forwardRef(
return;
}
AppStorage.session.setItem(snapshotSessionKey, gridState);
AppStorage.session.setItem(snapshotSessionKey, gridState, false);
}, 250);
};
useEffect(() => clearTimeout(persistGridStateTimeout.current), [location.key, persistGridStateTimeout.current]);

View File

@@ -269,7 +269,7 @@ export function SourceMangas() {
);
const scrollToTop = useCallback(() => {
AppStorage.session.setItem(getGridSnapshotKey(location), undefined);
AppStorage.session.setItem(getGridSnapshotKey(location), undefined, false);
window.scrollTo(0, 0);
}, [locationKey]);