Skip to content

Commit

Permalink
fix(timeline): stabilize timeline ID handling with memoized state
Browse files Browse the repository at this point in the history
Introduce a memoized state for timelineId to ensure consistent rendering and prevent potential race conditions when route parameters change dynamically.

Signed-off-by: Innei <tukon479@gmail.com>
  • Loading branch information
Innei committed Feb 14, 2025
1 parent 665cf95 commit d161213
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/renderer/src/modules/timeline-column/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ export function FeedColumn({ children, className }: PropsWithChildren<{ classNam
view: s.view,
listId: s.listId,
}))
const { timelineId } = routeParams

const [timelineId, setMemoizedTimelineId] = useState(routeParams.timelineId)

useEffect(() => {
if (routeParams.timelineId) setMemoizedTimelineId(routeParams.timelineId)
}, [routeParams.timelineId])

const navigateBackHome = useBackHome(timelineId)
const setActive = useCallback(
Expand Down

0 comments on commit d161213

Please sign in to comment.