From 972ebbae2f40801ef73126a118ca3b603f320481 Mon Sep 17 00:00:00 2001 From: "Query&mut NinjaStyle, &Ryder" <97464694+X1Vi@users.noreply.github.com> Date: Fri, 10 Jan 2025 18:13:46 +0530 Subject: [PATCH] fix: compact mode storage (#4279) fix #4274 now when checkbox is toggled the memo remembers the compact state Co-authored-by: root --- web/src/components/MemoContent/index.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/src/components/MemoContent/index.tsx b/web/src/components/MemoContent/index.tsx index bc893be844b87..e735f5612d748 100644 --- a/web/src/components/MemoContent/index.tsx +++ b/web/src/components/MemoContent/index.tsx @@ -72,6 +72,10 @@ const MemoContent: React.FC = (props: Props) => { SNIPPET: { text: t("memo.show-less"), nextState: "ALL" }, }; + useEffect(() => { + sessionStorage.getItem(`${memoName}`) && setShowCompactMode(sessionStorage.getItem(`${memoName}`) as ContentCompactView); + }, []); + return ( = (props: Props) => { className="w-auto flex flex-row justify-start items-center cursor-pointer text-sm text-blue-600 dark:text-blue-400 hover:opacity-80" onClick={() => { setShowCompactMode(compactStates[showCompactMode].nextState as ContentCompactView); + sessionStorage.setItem(`${memoName}`, compactStates[showCompactMode].nextState); }} > {compactStates[showCompactMode].text}