Loading...
Loading...
Reusable Studio chart performance audit and fix workflow. Use when a chart feels sluggish in /studio (pan, slider ticks, legend hover) but siblings like pie-chart feel fine.
npx skill4agent add bklit/bklit-ui bklit-studio-chart-performancedisplayStatedata.mapkeyhoveredIndexusePieStableuseRingStableuseChartStableStudioChartRenderpackages/studio/src/components/studio-chart-render.tsxdduseTransform| Prefer | Avoid |
|---|---|
| Continuous |
Static | Keeping Motion subscriptions on |
| Enter animation only, then static paths | Re-running enter path math on unrelated prop changes |
useMountProgressuseEnterCompletexyopacityscalemotion.gscalemotion.pathpackages/ui/src/charts/use-enter-complete.tshoveredIndexsetHoveredIndexuseCallbackisLoadeduseEffectuseStatepie-context.tsxring-context.tsxchart-context.tsxPieChartCoreRingChartCoreuseMemopackages/studio/src/components/charts/*-studio*.tsx| Win | How |
|---|---|
| Conditional defs | Only pass |
| Memo derived data | Colored/mapped data arrays; slice/series lists ( |
| Memo motion enter | Don't call |
| Memo legend hover | |
| Memo chart body | |
| Disable glow in Studio | |
pie-studio-preview.tsxring-studio-preview.tsx| Check | Slow chart often has | Fast chart often has |
|---|---|---|
| Shell | Inline render, extra defs | |
| Series count | Many animated paths | Fewer paths or simpler geometry |
| Hover | Context + full tree re-render | Stable subscribers; hover on |
| Enter | Path | Static |
| Pan | Chart tree rebuilds every frame | |
pnpm lint
pnpm --filter @bklitui/ui check-types
pnpm --filter @bklitui/studio check-types
# scoped production build when touching studio/web/studio?chart=<slug>| Chart | Slug | Status |
|---|---|---|
| Pie | | ✅ Reference (#120) |
| Ring | | ✅ Aligned to checklist (context split, static paths, |
| Radar / Funnel / Choropleth | various | Partial — run checklist |
| Cartesian / scatter / live-line | various | ✅ #91 decimation + hover batching |
| Sankey | | |
| Gauge | | Low priority (single arc) |
| Area | Path |
|---|---|
| Enter-complete hook | |
| Pie reference | |
| Ring | |
| Pan isolation | |
| Registry | |