diff --git a/web/src/components/MemoActionMenu.tsx b/web/src/components/MemoActionMenu.tsx index b455dac9a..e5d6e0976 100644 --- a/web/src/components/MemoActionMenu.tsx +++ b/web/src/components/MemoActionMenu.tsx @@ -90,16 +90,10 @@ const MemoActionMenu = observer((props: Props) => { } }; - //async () => {} = () => Promise.resolve({}) - //await promiseFunc, this just waits for the promise to be fulfilled - //use async just so we can use await inside, dont care about returned Promise const handleToggleMemoStatusClick = async () => { - //changing the state const state = memo.state === State.ARCHIVED ? State.NORMAL : State.ARCHIVED; - //showing message depending on state const message = memo.state === State.ARCHIVED ? t("message.restored-successfully") : t("message.archived-successfully"); try { - //must wait for this promise returned by updateMemo to be fulfileld before continuing await memoStore.updateMemo( { name: memo.name, @@ -108,44 +102,32 @@ const MemoActionMenu = observer((props: Props) => { ["state"], ); - //Show toast with Undo button - //input is function that takes in the toast object we will work with and it will be used in the output of the higher order function - toast.custom( - ( - tToast, - ) => ( - //div container -
- {message} - -
- ), - ); + toast.custom((tToast) => ( +
+ {message} + +
+ )); } catch (error: any) { toast.error(error.details); console.error(error); @@ -188,7 +170,6 @@ const MemoActionMenu = observer((props: Props) => { const children = node.listNode.children; for (let i = 0; i < children.length; i++) { if (children[i].type === NodeType.TASK_LIST_ITEM && children[i].taskListItemNode?.complete) { - // Remove completed taskList item and next line breaks children.splice(i, 1); if (children[i]?.type === NodeType.LINE_BREAK) { children.splice(i, 1);