From 11324364a5aa947a884c71ef078008733ccbe863 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun <cheeaun@gmail.com>
Date: Fri, 24 Mar 2023 01:04:47 +0800
Subject: [PATCH] Test add this as dep

---
 src/components/timeline.jsx | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/src/components/timeline.jsx b/src/components/timeline.jsx
index 4d37e6c7..cf6a3066 100644
--- a/src/components/timeline.jsx
+++ b/src/components/timeline.jsx
@@ -193,24 +193,27 @@ function Timeline({
   }, [nearReachEnd, showMore]);
 
   const lastHiddenTime = useRef();
-  usePageVisibility((visible) => {
-    if (visible) {
-      const timeDiff = Date.now() - lastHiddenTime.current;
-      if (!lastHiddenTime.current || timeDiff > 1000 * 60) {
-        (async () => {
-          console.log('✨ Check updates');
-          const hasUpdate = await checkForUpdates();
-          if (hasUpdate) {
-            console.log('✨ Has new updates');
-            setShowNew(true);
-          }
-        })();
+  usePageVisibility(
+    (visible) => {
+      if (visible) {
+        const timeDiff = Date.now() - lastHiddenTime.current;
+        if (!lastHiddenTime.current || timeDiff > 1000 * 60) {
+          (async () => {
+            console.log('✨ Check updates');
+            const hasUpdate = await checkForUpdates();
+            if (hasUpdate) {
+              console.log('✨ Has new updates');
+              setShowNew(true);
+            }
+          })();
+        }
+      } else {
+        lastHiddenTime.current = Date.now();
       }
-    } else {
-      lastHiddenTime.current = Date.now();
-    }
-    setVisible(visible);
-  }, []);
+      setVisible(visible);
+    },
+    [checkForUpdates],
+  );
 
   // checkForUpdates interval
   useInterval(