From 23eeaa05ea9e816ab55c87f47a575b219c4ceaf0 Mon Sep 17 00:00:00 2001
From: crupest <crupest@outlook.com>
Date: Sun, 16 May 2021 20:41:41 +0800
Subject: feat: Now card is default collapsed.

---
 FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx')

diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx
index 81a3c179..6e9eba25 100644
--- a/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx
+++ b/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx
@@ -109,10 +109,12 @@ const TimelinePageTemplate: React.FC<TimelinePageTemplateProps> = (props) => {
   const cardCollapseLocalStorageKey = `timeline.${timelineName}.cardCollapse`;
 
   const [cardCollapse, setCardCollapse] = React.useState<boolean>(true);
+
   React.useEffect(() => {
-    const savedCollapse =
-      window.localStorage.getItem(cardCollapseLocalStorageKey) === "true";
-    setCardCollapse(savedCollapse);
+    const savedCollapse = window.localStorage.getItem(
+      cardCollapseLocalStorageKey
+    );
+    setCardCollapse(savedCollapse == null ? true : savedCollapse === "true");
   }, [cardCollapseLocalStorageKey]);
 
   const toggleCardCollapse = (): void => {
-- 
cgit v1.2.3

