From aafd0e8545356d60e3364fe8747d8c4d0c321223 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Fri, 9 Oct 2026 23:26:14 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9A=A1=20Bolt:=20=EB=B0=B0=EC=97=B4=20?= =?UTF-8?q?=EC=B5=9C=EB=8C=93=EA=B0=92=20=EC=97=B0=EC=82=B0=20spread=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0=20=EB=B0=8F=20reduce=20=EC=A0=81=EC=9A=A9=20?= =?UTF-8?q?(=EC=84=9C=EB=B2=84=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95=20=EB=B0=98=EC=98=81)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .jules/bolt.md | 6 ++++++ .../src/app/dashboard/[orgSlug]/settings/members/page.tsx | 2 +- .../src/components/dashboard/reports/delegation-insight.tsx | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.jules/bolt.md b/.jules/bolt.md index 57daf471..1263f3bc 100644 --- a/.jules/bolt.md +++ b/.jules/bolt.md @@ -3,3 +3,9 @@ **Learning:** `Date.parse(value)` returns the timestamp primitive directly, while `new Date(value).getTime()` also constructs a `Date` object. Both use the same ECMAScript string-parsing semantics for these call sites. **Action:** In frequently executed paths that only need a timestamp primitive, prefer `Date.parse(value)`. Treat the allocation reduction as a bounded micro-optimization unless a committed benchmark establishes a larger runtime effect. + +## 2026-10-09 - `Math.max` array spread optimization with `useMemo` + +**Learning:** When using `Math.max(...array)` on potentially large arrays within React components, it triggers the spread operator on every render, which can lead to 'Maximum call stack size exceeded' for very large arrays, and recalculates unnecessarily. + +**Action:** In React components that render lists or depend on max value calculations from array props, use `.reduce()` instead of the spread operator to prevent call stack issues, and wrap the calculation with `useMemo` to prevent recalculation on every render. diff --git a/packages/web/src/app/dashboard/[orgSlug]/settings/members/page.tsx b/packages/web/src/app/dashboard/[orgSlug]/settings/members/page.tsx index 5d6ef680..bba5b871 100644 --- a/packages/web/src/app/dashboard/[orgSlug]/settings/members/page.tsx +++ b/packages/web/src/app/dashboard/[orgSlug]/settings/members/page.tsx @@ -83,7 +83,7 @@ function MembersTable({ const removeMember = useRemoveMember(orgSlug) const [errorByUser, setErrorByUser] = useState>({}) - const maxCost = Math.max(...members.map((m) => m.sevenDayCostUsd), 0) + const maxCost = members.reduce((max, m) => Math.max(max, m.sevenDayCostUsd), 0) const canChangeToOwner = currentRole === 'OWNER' const adminCount = members.filter( (m) => m.role === 'OWNER' || m.role === 'MANAGER' diff --git a/packages/web/src/components/dashboard/reports/delegation-insight.tsx b/packages/web/src/components/dashboard/reports/delegation-insight.tsx index ecb6b7c4..f3bb86f4 100644 --- a/packages/web/src/components/dashboard/reports/delegation-insight.tsx +++ b/packages/web/src/components/dashboard/reports/delegation-insight.tsx @@ -28,7 +28,7 @@ export function DelegationInsight({ insight, orgSlug }: DelegationInsightProps) ) } - const maxCount = Math.max(1, ...insight.topAgents.map((a) => a.callCount)) + const maxCount = insight.topAgents.reduce((max, a) => Math.max(max, a.callCount), 1) return ( Date: Fri, 9 Oct 2026 23:29:54 +0000 Subject: [PATCH 2/3] Acknowledge CI billing issue failure From 036f72beb7c62b2e7668221c21437aa784bb7126 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Fri, 9 Oct 2026 23:32:48 +0000 Subject: [PATCH 3/3] Acknowledge CI billing issue failure