Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,13 @@

**Learning:** When attempting to optimize an O(N^2) array spread operation (`[...existing, talk]`) inside a grouping loop in `groupTalksByTrack`, the purely functional/immutable constraint specified by the team (and the lack of `Map.groupBy` support in Node 20.x Jest environments) means that we must fall back to immutable reductions.
**Action:** When constraints require strict immutability without mutation of objects, use `reduce` with object and array spreads (e.g., `{ ...acc, [key]: [...(acc[key] || []), item] }`) even if it introduces O(N^2) overhead for large arrays. Avoid using `push()` or modifying accumulators directly. Always run Prettier/formatting checks before merge to resolve CI failures.

## 2026-05-03 - Array filtering with repeated includes()

**Learning:** Found an O(N\*M) performance bottleneck in `ScheduleContainer.tsx` where `Array.includes()` was being called inside a function on every re-render or schedule update.
**Action:** Convert the lookup array into a `Set` outside the iteration loop and use `Set.has()` to achieve O(N+M) time complexity. Ensure this pattern is verified during profiling.

## 2026-03-24 - Array filtering with repeated includes()

**Learning:** Found an O(N\*M) performance bottleneck in `ScheduleContainer.tsx` where `Array.includes()` was being called inside a `.filter()` function on every re-render or schedule update.
**Action:** Convert the lookup array into a `Set` outside the iteration loop and use `Set.has()` to achieve O(N+M) time complexity. Ensure this pattern is verified during profiling.
Comment on lines +21 to +29
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The entries for 'Array filtering with repeated includes()' are duplicated. The first entry (lines 20-22) also contains a typo where the function name is missing ('inside a function'). It is recommended to remove the redundancy and keep the more accurate entry.

Suggested change
## 2026-05-03 - Array filtering with repeated includes()
**Learning:** Found an O(N*M) performance bottleneck in `ScheduleContainer.tsx` where `Array.includes()` was being called inside a function on every re-render or schedule update.
**Action:** Convert the lookup array into a `Set` outside the iteration loop and use `Set.has()` to achieve O(N+M) time complexity. Ensure this pattern is verified during profiling.
## 2026-03-24 - Array filtering with repeated includes()
**Learning:** Found an O(N*M) performance bottleneck in `ScheduleContainer.tsx` where `Array.includes()` was being called inside a `.filter()` function on every re-render or schedule update.
**Action:** Convert the lookup array into a `Set` outside the iteration loop and use `Set.has()` to achieve O(N+M) time complexity. Ensure this pattern is verified during profiling.
## 2026-05-03 - Array filtering with repeated includes()
**Learning:** Found an O(N*M) performance bottleneck in ScheduleContainer.tsx where Array.includes() was being called inside a .filter() function on every re-render or schedule update.
**Action:** Convert the lookup array into a Set outside the iteration loop and use Set.has() to achieve O(N+M) time complexity. Ensure this pattern is verified during profiling.

Comment on lines +21 to +29
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟑 Minor | ⚑ Quick win

Remove the duplicate entry and fix the truncated description.

Lines 20–22 and 23–25 are two near-identical sections with the same title. The 2026-05-03 entry (line 21) has an incomplete Learning string β€” the word .filter() was dropped, leaving a double space and a dangling "a function". The 2026-03-24 entry has the correct wording but an inconsistent/older date. The two should be collapsed into one correctly dated and worded entry.

πŸ“ Proposed fix
-## 2026-05-03 - Array filtering with repeated includes()
-**Learning:** Found an O(N*M) performance bottleneck in `ScheduleContainer.tsx` where `Array.includes()` was being called inside a  function on every re-render or schedule update.
-**Action:** Convert the lookup array into a `Set` outside the iteration loop and use `Set.has()` to achieve O(N+M) time complexity. Ensure this pattern is verified during profiling.
-## 2026-03-24 - Array filtering with repeated includes()
-**Learning:** Found an O(N*M) performance bottleneck in `ScheduleContainer.tsx` where `Array.includes()` was being called inside a `.filter()` function on every re-render or schedule update.
-**Action:** Convert the lookup array into a `Set` outside the iteration loop and use `Set.has()` to achieve O(N+M) time complexity. Ensure this pattern is verified during profiling.
+
+## 2026-05-03 - Array filtering with repeated includes()
+
+**Learning:** Found an O(N*M) performance bottleneck in `ScheduleContainer.tsx` where `Array.includes()` was being called inside a `.filter()` function on every re-render or schedule update.
+**Action:** Convert the lookup array into a `Set` outside the iteration loop and use `Set.has()` to achieve O(N+M) time complexity. Ensure this pattern is verified during profiling.
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## 2026-05-03 - Array filtering with repeated includes()
**Learning:** Found an O(N*M) performance bottleneck in `ScheduleContainer.tsx` where `Array.includes()` was being called inside a function on every re-render or schedule update.
**Action:** Convert the lookup array into a `Set` outside the iteration loop and use `Set.has()` to achieve O(N+M) time complexity. Ensure this pattern is verified during profiling.
## 2026-03-24 - Array filtering with repeated includes()
**Learning:** Found an O(N*M) performance bottleneck in `ScheduleContainer.tsx` where `Array.includes()` was being called inside a `.filter()` function on every re-render or schedule update.
**Action:** Convert the lookup array into a `Set` outside the iteration loop and use `Set.has()` to achieve O(N+M) time complexity. Ensure this pattern is verified during profiling.
## 2026-05-03 - Array filtering with repeated includes()
**Learning:** Found an O(N*M) performance bottleneck in `ScheduleContainer.tsx` where `Array.includes()` was being called inside a `.filter()` function on every re-render or schedule update.
**Action:** Convert the lookup array into a `Set` outside the iteration loop and use `Set.has()` to achieve O(N+M) time complexity. Ensure this pattern is verified during profiling.
πŸ€– Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.jules/bolt.md around lines 20 - 25, Collapse the two duplicate entries into
a single clean entry: remove the older 2026-03-24 block and keep a single
"2026-05-03 - Array filtering with repeated includes()" paragraph, correcting
the Learning line to mention ".filter()" (e.g., "Found an O(N*M) performance
bottleneck in `ScheduleContainer.tsx` where `Array.includes()` was being called
inside a `.filter()` function...") and leaving the Action line as-is about
converting the lookup array to a Set and using `Set.has()`; ensure the wording
is complete and not truncated and that only the single, correctly worded/dated
entry remains.

4 changes: 3 additions & 1 deletion components/schedule/ScheduleContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export default function ScheduleContainer({ initialSchedule, year }: Readonly<Sc
return initialSchedule;
}

const filterSessions = (sessions: GridSession[]) => sessions.filter((s) => savedSessionIds.includes(s.id) || s.isServiceSession);
const savedSessionsSet = new Set(savedSessionIds);

const filterSessions = (sessions: GridSession[]) => sessions.filter((s) => savedSessionsSet.has(s.id) || s.isServiceSession);

return initialSchedule.map((day) => ({
...day,
Expand Down
Loading