ScrollableList: clear scrollData useMemo if scrollKey changes
This commit is contained in:
parent
36fb7fea7d
commit
8baa4cd262
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue