mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
fix: Selected notes become deselected on scroll
(fixes streetwriters/notesnook#427)
This commit is contained in:
@@ -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 ? (
|
||||
|
||||
@@ -58,12 +58,6 @@ function ListItem(props) {
|
||||
|
||||
const selectItem = useSelectionStore((store) => store.selectItem);
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
selectionStore.toggleSelectionMode(false);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Flex
|
||||
ref={listItemRef}
|
||||
|
||||
Reference in New Issue
Block a user