AddThisFeature

Render Stability Guardrails

Make render optimisation provable, so it removes work instead of introducing stale UI.

moderate Front-End Performance

What it adds

A set of rules and checks governing memoisation, keys, and render boundaries on the app's busiest views.

What your agent is told to do

5
  1. 1

    Profile a real interaction on a real view before changing anything, and write down the cost being removed. An optimisation with no measured baseline cannot be shown to have worked and cannot be safely reverted.

  2. 2

    Require every cached callback and derived value to declare each value it reads, and treat a missing declaration as a defect — a handler holding last render's values will act on data the user can no longer see.

  3. 3

    Derive list keys from the stable identity of the record. A position-based key silently reuses the wrong element as soon as the list is sorted, filtered, or has an item removed from the middle.

  4. 4

    Exercise the app under the framework's development double-render and its concurrent scheduling behaviour, because side effects performed during render and effects that assume they run exactly once only misbehave there.

  5. 5

    Do not memoise every component as a matter of course. Comparison is not free, a component receiving a freshly built object or inline function on each render is never actually skipped, and blanket caching hides the one place that was genuinely slow.

Edge cases it handles

7
  • An optimisation added without a measurement is indistinguishable from a regression. Keep the before-and-after profile with the change so the next person can tell which it was.
  • A cached handler that captured an earlier value will submit stale form data, act on a record the user already deleted, or ignore a filter that has since changed. Verify handlers against changing state, not just against a first render.
  • Keys must be stable across reorders and meaningful across renders. Reusing a position as a key will leave typed input, selection, and scroll position attached to the wrong row.
  • Development double-rendering and concurrent scheduling will run effects and render bodies more than once. Subscriptions, timers, and analytics events must tolerate that without duplicating, and cleanup must genuinely undo setup.
  • Memoisation is defeated by props rebuilt on each render — objects, arrays, and inline functions declared in the parent. Confirm the boundary actually skips work rather than assuming it does.
  • Deriving state from props into local state creates two sources of truth that drift; prefer computing during render over copying.
  • Cell and row components inside a windowed list are the usual subject here — memoisation of those belongs to this brief, while the windowing itself belongs to the Windowed Grid Primitive.

Definition of done

8
  • Every memoisation in the codebase has a recorded measurement showing what it saves.
  • Cached callbacks and derived values declare all the values they read.
  • No list key is derived from array position on a list that can reorder, filter, or delete.
  • The app behaves correctly under development double-rendering and concurrent scheduling, with no duplicated subscriptions, timers, or events.
  • Memoised boundaries verifiably skip work rather than being defeated by freshly constructed props.
  • No component copies props into local state where a derived value would do.
  • The feature matches the existing design system.
  • No existing functionality is broken.

Related features

How it works

  1. 1

    Copy the link

    Grab the Markdown instruction URL for this feature.

  2. 2

    Give it to your AI

    Paste it into Claude Code, Cursor, v0, Lovable — whatever you build with.

  3. 3

    It inspects, then implements

    Your agent reads your existing app first, then adds the feature to fit it.

Works with your stack

These instructions are written to adapt. They tell the agent to detect your framework, match your existing design system, and reuse what you already have — rather than assuming a particular stack.

Need it tighter than that? Customize the feature and tell it exactly what you're running.