mobile: fix notebook note count not updated on deleting note

This commit is contained in:
Ammar Ahmed
2026-04-10 11:59:00 +05:00
parent 72f3d93b58
commit a1aec31d8c
2 changed files with 4 additions and 1 deletions

View File

@@ -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) => {

View File

@@ -211,6 +211,7 @@ export const deleteItems = async (
useNotebookStore.getState().refresh();
}
useMenuStore.getState().setMenuPins();
useRelationStore.getState().update();
};
export const openLinkInBrowser = async (link: string) => {