ScrollableList: clear scrollData useMemo if scrollKey changes

dnd
Alex Gleason 2022-06-02 20:40:14 -05:00
rodzic 36fb7fea7d
commit 8baa4cd262
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -84,7 +84,7 @@ const ScrollableList = React.forwardRef<VirtuosoHandle, IScrollableList>(({
// Preserve scroll position
const scrollDataKey = `soapbox:scrollData:${scrollKey}`;
const scrollData: SavedScrollPosition | null = useMemo(() => JSON.parse(sessionStorage.getItem(scrollDataKey)!), []);
const scrollData: SavedScrollPosition | null = useMemo(() => JSON.parse(sessionStorage.getItem(scrollDataKey)!), [scrollDataKey]);
const topIndex = useRef<number>(scrollData ? scrollData.index : 0);
const topOffset = useRef<number>(scrollData ? scrollData.offset : 0);