From a1aec31d8c283f6717eeee42aa36504372df6fdf Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Fri, 10 Apr 2026 11:59:00 +0500 Subject: [PATCH] mobile: fix notebook note count not updated on deleting note --- apps/mobile/app/components/side-menu/notebook-item.tsx | 4 +++- apps/mobile/app/utils/functions.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/mobile/app/components/side-menu/notebook-item.tsx b/apps/mobile/app/components/side-menu/notebook-item.tsx index e6538e0f9..625eba1be 100644 --- a/apps/mobile/app/components/side-menu/notebook-item.tsx +++ b/apps/mobile/app/components/side-menu/notebook-item.tsx @@ -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) => { diff --git a/apps/mobile/app/utils/functions.ts b/apps/mobile/app/utils/functions.ts index f6f7aca97..c01e2dffe 100644 --- a/apps/mobile/app/utils/functions.ts +++ b/apps/mobile/app/utils/functions.ts @@ -211,6 +211,7 @@ export const deleteItems = async ( useNotebookStore.getState().refresh(); } useMenuStore.getState().setMenuPins(); + useRelationStore.getState().update(); }; export const openLinkInBrowser = async (link: string) => {