From 9274a6aa52b3d899c4fb0f1bf1403c91fa22069d Mon Sep 17 00:00:00 2001 From: anyulled <100741+anyulled@users.noreply.github.com> Date: Mon, 18 May 2026 08:45:08 +0000 Subject: [PATCH] feat: optimize schedule filtering with Set lookup Convert the savedSessionIds array to a Set before performing lookups inside the filter loop to reduce time complexity from O(N*M) to O(N+M). Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- components/schedule/ScheduleContainer.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/schedule/ScheduleContainer.tsx b/components/schedule/ScheduleContainer.tsx index 33d877a4..f6453839 100644 --- a/components/schedule/ScheduleContainer.tsx +++ b/components/schedule/ScheduleContainer.tsx @@ -20,7 +20,9 @@ export default function ScheduleContainer({ initialSchedule, year }: Readonly sessions.filter((s) => savedSessionIds.includes(s.id) || s.isServiceSession); + const savedSessionIdsSet = new Set(savedSessionIds); + + const filterSessions = (sessions: GridSession[]) => sessions.filter((s) => savedSessionIdsSet.has(s.id) || s.isServiceSession); return initialSchedule.map((day) => ({ ...day,