Skip to content

Commit 8e6ca79

Browse files
jdonelsonclaude
andcommitted
console: Drop three freshness memos that never hit
A useMemo only pays when something downstream compares identities. These fed components that re-render regardless. The cluster list memo is followed by an unmemoized map of the same array, over a few dozen clusters. The object IDs memo feeds a query key that sorts and joins them into a string, so a new array does not refetch. The row click memo reaches UniversalTable, which is not memoized. The last one is mine rather than the reviewer's, and fails the same test. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
1 parent 003db7b commit 8e6ca79

3 files changed

Lines changed: 7 additions & 16 deletions

File tree

‎console/src/platform/clusters/queries.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,10 +1124,7 @@ export function useClusterFreshness({
11241124
lookbackMs,
11251125
objects,
11261126
}: ClusterFreshnessParams) {
1127-
const objectIds = useMemo(
1128-
() => objects.map((object) => object.objectId),
1129-
[objects],
1130-
);
1127+
const objectIds = objects.map((object) => object.objectId);
11311128

11321129
// The binned series and the latest readings go in separate requests because
11331130
// they go stale at different rates. A bin cannot change faster than its own

‎console/src/platform/freshness/FreshnessPage.tsx‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,9 @@ const FreshnessPage = () => {
295295
const thresholdControl = useThresholdControl(threshold, setThreshold);
296296

297297
// Filter out system clusters
298-
const selectable = React.useMemo(
299-
() =>
300-
clusters
301-
.filter((c) => !isSystemCluster(c.id))
302-
.sort((a, b) => a.name.localeCompare(b.name)),
303-
[clusters],
304-
);
298+
const selectable = clusters
299+
.filter((c) => !isSystemCluster(c.id))
300+
.sort((a, b) => a.name.localeCompare(b.name));
305301
const selected = selectable.find((c) => c.id === clusterId) ?? selectable[0];
306302
const options: SelectOption[] = selectable.map((c) => ({
307303
id: c.id,

‎console/src/platform/freshness/FreshnessTable.tsx‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,9 @@ const FreshnessTableInner = ({
203203
getRowId: (row) => row.key,
204204
});
205205

206-
const onRowClick = React.useMemo(
207-
() =>
208-
onToggleRow ? (row: FreshnessRow) => onToggleRow(row.key) : undefined,
209-
[onToggleRow],
210-
);
206+
const onRowClick = onToggleRow
207+
? (row: FreshnessRow) => onToggleRow(row.key)
208+
: undefined;
211209

212210
return (
213211
<VStack spacing="4" alignItems="stretch" width="100%">

0 commit comments

Comments
 (0)