From 7ad7dafdab9f130aa44e4ae4a05720f16278335a Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Thu, 14 Dec 2023 15:59:58 -0700 Subject: [PATCH] Stop autoplay on open --- web-new/src/pages/History.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/web-new/src/pages/History.tsx b/web-new/src/pages/History.tsx index 8dd686b31..a1c7a1624 100644 --- a/web-new/src/pages/History.tsx +++ b/web-new/src/pages/History.tsx @@ -33,10 +33,6 @@ function History() { return ["timeline/hourly", { timezone, limit: API_LIMIT }]; }, []); - const shouldAutoPlay = useMemo(() => { - return window.innerWidth < 480; - }, []); - const { data: timelinePages, size, @@ -51,11 +47,13 @@ function History() { { revalidateOnFocus: false } ); - const [detailLevel, _] = useState<"normal" | "extra" | "full">( - "normal" - ); + const [detailLevel, _] = useState<"normal" | "extra" | "full">("normal"); const [playback, setPlayback] = useState(); + const shouldAutoPlay = useMemo(() => { + return playback == undefined && window.innerWidth < 480; + }, [playback]); + const timelineCards: CardsData | never[] = useMemo(() => { if (!timelinePages) { return [];