fix: Selected notes become deselected on scroll

(fixes streetwriters/notesnook#427)
This commit is contained in:
thecodrr
2022-03-23 09:59:30 +05:00
parent d509defe55
commit 922af0c404
2 changed files with 7 additions and 7 deletions

View File

@@ -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 ? (

View File

@@ -58,12 +58,6 @@ function ListItem(props) {
const selectItem = useSelectionStore((store) => store.selectItem);
useEffect(() => {
return () => {
selectionStore.toggleSelectionMode(false);
};
}, []);
return (
<Flex
ref={listItemRef}