Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: Cannot read property 'scrollToIndex' of undefined

thecodrrdea5a7208f83
diff --git a/apps/web/src/components/list-container/index.js b/apps/web/src/components/list-container/index.js
index 27634a199..25cb607ce 100644
--- a/apps/web/src/components/list-container/index.js
+++ b/apps/web/src/components/list-container/index.js
@@ -31,15 +31,6 @@ function ListContainer(props) {
setSelectedItems(items.filter((item) => item.type !== "header"));
}, [shouldSelectAll, type, setSelectedItems, items]);
- useEffect(() => {
- if (props.static) return;
- // whenever there is a change in items array we have to reset the size cache
- // so it can be recalculated.
- if (listRef.current) {
- listRef.current.resetAfterIndex(0, true);
- }
- }, [props.items, listRef, props.static]);
-
return (
<Flex variant="columnFill">
{!props.items.length && props.placeholder ? (
@@ -50,6 +41,7 @@ function ListContainer(props) {
<>
<Flex variant="columnFill" data-test-id="note-list">
<Virtuoso
+ ref={listRef}
data={items}
computeItemKey={(index) => items[index].id || items[index].title}
defaultItemHeight={profile.estimatedItemHeight}