Skip to content

Commit 5ace705

Browse files
committed
perf(block): replace measured goal grid with CSS
Remove clone-based intrinsic sizing and use equal responsive CSS grid tracks so large goal sets no longer trigger repeated DOM measurement.
1 parent 282f3f0 commit 5ace705

2 files changed

Lines changed: 2 additions & 92 deletions

File tree

app/src/components/block/goal-card.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
import { AlertTriangle, GripVertical, Lock, Plus, Star, Timer, X } from "lucide-react";
1818
import { Card, CardContent, CardHeader, CardTitle } from "#/components/ui/card.tsx";
1919
import { Tooltip } from "#/components/ui/tooltip.tsx";
20-
import { MeasuredWrapGrid } from "#/components/measured-wrap-grid.tsx";
2120
import { goalConsumes, STOCK_WINDOW_DEFAULT } from "../../lib/goals";
2221
import { Icon } from "../../lib/icons";
2322
import { EditableRate } from "./editable-rate.tsx";
@@ -103,7 +102,7 @@ export function GoalCard({
103102
collisionDetection={closestCenter}
104103
onDragEnd={onGoalDragEnd}
105104
>
106-
<MeasuredWrapGrid minColumnWidth={80} className="gap-2">
105+
<div className="grid auto-rows-max grid-cols-[repeat(auto-fill,minmax(5rem,1fr))] gap-2">
107106
<SortableContext items={goals.map((g) => g.name)} strategy={rectSortingStrategy}>
108107
{goals.map((goal, i) => {
109108
const g = goal.name;
@@ -309,7 +308,7 @@ export function GoalCard({
309308
<Plus className="size-6" />
310309
<span className="text-sm">goal</span>
311310
</button>
312-
</MeasuredWrapGrid>
311+
</div>
313312
</DndContext>
314313
{!target && (
315314
<div className="text-sm text-muted-foreground">

app/src/components/measured-wrap-grid.tsx

Lines changed: 0 additions & 89 deletions
This file was deleted.

0 commit comments

Comments
 (0)