From 3c9ee4e2bebb5fe9feb75d5cc541e2fdefdbefa0 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Tue, 8 Apr 2025 14:35:45 +0500 Subject: [PATCH] web: fix note counts not updating in notebooks list --- apps/web/src/components/notebook/index.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/web/src/components/notebook/index.tsx b/apps/web/src/components/notebook/index.tsx index e1f07044b..67caaa363 100644 --- a/apps/web/src/components/notebook/index.tsx +++ b/apps/web/src/components/notebook/index.tsx @@ -65,10 +65,12 @@ export function Notebook(props: NotebookProps) { refresh = () => {}, depth = 0 } = props; - const isOpened = useNotesStore( - (store) => - store.context?.type === "notebook" && store.context.id === item.id + const currentContext = useNotesStore((store) => + store.context?.type === "notebook" && store.context.id === item.id + ? store.contextNotes + : null ); + const isOpened = !!currentContext; const dragTimeout = useRef(0); const { isDragEntering, isDragLeaving } = useDragHandler(`id_${item.id}`); @@ -154,7 +156,11 @@ export function Notebook(props: NotebookProps) { } - footer={{totalNotes}} + footer={ + + {currentContext ? currentContext?.length : totalNotes} + + } menuItems={notebookMenuItems} context={{ refresh }} sx={{