Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
fix(web): handle delete memo errors and only run post-delete actions on success
Steven6eaab52e4859
diff --git a/web/src/components/MemoActionMenu/hooks.ts b/web/src/components/MemoActionMenu/hooks.tsindex e4e52b63c..ddac3895b 100644--- a/web/src/components/MemoActionMenu/hooks.ts+++ b/web/src/components/MemoActionMenu/hooks.ts@@ -98,15 +98,16 @@ export const useMemoActionHandlers = ({ memo, onEdit, setDeleteDialogOpen }: Use}, [setDeleteDialogOpen]);const confirmDeleteMemo = useCallback(async () => {- await deleteMemo(memo.name, {- onSuccess: () => {- // If this was a comment, refresh the parent memo's comments list so it disappears from the UI- if (memo.parent) {- queryClient.invalidateQueries({ queryKey: memoKeys.comments(memo.parent) });- }- },- });+ try {+ await deleteMemo(memo.name);+ } catch (error: unknown) {+ handleError(error, toast.error, { context: "Delete memo", fallbackMessage: "An error occurred" });+ return;+ }toast.success(t("message.deleted-successfully"));+ if (memo.parent) {+ queryClient.invalidateQueries({ queryKey: memoKeys.comments(memo.parent) });+ }if (isInMemoDetailPage) {navigateTo("/");}