From 497c73725cc1683d7d085bbaee94a7e1340a5a9b Mon Sep 17 00:00:00 2001 From: alikia2x Date: Wed, 1 Jan 2025 18:47:22 +0800 Subject: [PATCH] update: index.tsx --- pages/rewind/index.tsx | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/pages/rewind/index.tsx b/pages/rewind/index.tsx index bb46ed0..cd3c689 100644 --- a/pages/rewind/index.tsx +++ b/pages/rewind/index.tsx @@ -39,6 +39,7 @@ function Image({ src }: { src: string }) { ); } +// TODO: Memory optimization export default function RewindPage() { const { port, apiKey } = useAtomValue(apiInfoAtom); const [timeline, setTimeline] = useState([]); @@ -168,9 +169,9 @@ export default function RewindPage() { const handleScroll = (e: React.WheelEvent) => { if (!containerRef.current || !currentFrameId) return; - // Only allow scroll changes every 80ms + // Only allow scroll changes every 30ms const now = Date.now(); - if (now - lastScrollTime.current < 80) return; + if (now - lastScrollTime.current < 30) return; lastScrollTime.current = now; const delta = Math.sign(e.deltaY); @@ -235,30 +236,6 @@ export default function RewindPage() { ) || "Loading..." : "Loading..."} - - {/* Timeline */} -
- {timeline - .filter((frame) => frame.id <= currentFrameId!) - .map((frame) => ( -
{ - setCurrentFrameId(frame.id); - loadImage(frame.id); - }} - > - #{frame.id} - - {dayjs().diff(dayjs.unix(frame.createdAt), "second")} sec ago - -
- ))} -
); }