Concrete
Rulesrender

concrete/render/determinism-drift

An instance renders different markup twice from the same input.

An instance renders different markup twice from the same input.

Graded by the render stage of concrete check, in the render venue. A violation reports this id and the file it failed at — see every rule and concrete check.

Reason

The stage renders each instance twice from the same input and compares the markup, because two processes render your section and must agree: the publisher that writes the page and the editor that redraws the canvas. Server-rendered code is a pure function of its props for that reason — a value that changes between two renders makes the editor diff against markup the publisher never wrote, and the page shifts under whoever is editing it.

Fix

Take the varying value out. Module-level mutable state is the usual culprit — a counter, a cache, a lazily built id — and an index you need is already on the row binding, and a stable anchor on nav.selfAnchor. A clock or a random source is banned outright by server/no-nondeterminism.

Before and after

import { Section, section, Slot, text } from "@homepages/concrete";

// Module state: one more on every render, and the two renders disagree.
let seen = 0;

export const Hero = section(
  { key: "hero", label: "Hero", slots: { headline: text.medium({ label: "Headline" }) } },
  ({ slot }) => {
    seen += 1;
    return (
      <Section>
        <Slot.Text slot={slot.headline} as="h1" id={`headline-${String(seen)}`} />
      </Section>
    );
  },
);
import { Section, section, Slot, text } from "@homepages/concrete";

export const Hero = section(
  { key: "hero", label: "Hero", slots: { headline: text.medium({ label: "Headline" }) } },
  ({ slot, nav }) => (
    <Section>
      <Slot.Text slot={slot.headline} as="h1" id={`${nav.selfAnchor}-headline`} />
    </Section>
  ),
);

On this page