mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 11:39:21 +02:00
mobile: fix notebook note count not updated on deleting note
This commit is contained in:
@@ -35,6 +35,7 @@ import AppIcon from "../ui/AppIcon";
|
||||
import { IconButton } from "../ui/icon-button";
|
||||
import { Pressable } from "../ui/pressable";
|
||||
import Paragraph from "../ui/typography/paragraph";
|
||||
import { useRelationStore } from "../../stores/use-relation-store";
|
||||
|
||||
export const NotebookItem = ({
|
||||
index,
|
||||
@@ -70,13 +71,14 @@ export const NotebookItem = ({
|
||||
const notebook = item.notebook;
|
||||
const isFocused = focused;
|
||||
const { totalNotes, getTotalNotes } = useTotalNotes("notebook");
|
||||
const updater = useRelationStore(state => state.updater);
|
||||
const getTotalNotesRef = React.useRef(getTotalNotes);
|
||||
getTotalNotesRef.current = getTotalNotes;
|
||||
const { colors } = useThemeColors();
|
||||
|
||||
useEffect(() => {
|
||||
getTotalNotesRef.current([item.notebook.id]);
|
||||
}, [item.notebook]);
|
||||
}, [item.notebook, updater]);
|
||||
|
||||
useEffect(() => {
|
||||
const onNotebookUpdate = (id?: string) => {
|
||||
|
||||
@@ -211,6 +211,7 @@ export const deleteItems = async (
|
||||
useNotebookStore.getState().refresh();
|
||||
}
|
||||
useMenuStore.getState().setMenuPins();
|
||||
useRelationStore.getState().update();
|
||||
};
|
||||
|
||||
export const openLinkInBrowser = async (link: string) => {
|
||||
|
||||
Reference in New Issue
Block a user