Skip to content

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

fix: Selected notes become deselected on scroll (fixes streetwriters/notesnook#427)

thecodrr922af0c40488
diff --git a/apps/web/src/components/list-container/index.js b/apps/web/src/components/list-container/index.js
index 6793d24ee..784746f00 100644
--- a/apps/web/src/components/list-container/index.js
+++ b/apps/web/src/components/list-container/index.js
@@ -1,4 +1,4 @@
-import { useMemo, useRef, useState } from "react";
+import { useEffect, useMemo, useRef, useState } from "react";
import { Flex, Button } from "rebass";
import * as Icon from "../icons";
import { Virtuoso } from "react-virtuoso";
@@ -29,6 +29,12 @@ function ListContainer(props) {
[props.items]
);
+ useEffect(() => {
+ return () => {
+ selectionStore.toggleSelectionMode(false);
+ };
+ }, []);
+
return (
<Flex variant="columnFill">
{!props.items.length && props.placeholder ? (
diff --git a/apps/web/src/components/list-item/index.js b/apps/web/src/components/list-item/index.js
index 3a7c14240..90b468819 100644
--- a/apps/web/src/components/list-item/index.js
+++ b/apps/web/src/components/list-item/index.js
@@ -58,12 +58,6 @@ function ListItem(props) {
const selectItem = useSelectionStore((store) => store.selectItem);
- useEffect(() => {
- return () => {
- selectionStore.toggleSelectionMode(false);
- };
- }, []);
-
return (
<Flex
ref={listItemRef}