Back to Plate

V2 renderer primitives should own node shapes not example markup

docs/solutions/logic-errors/2026-04-04-v2-renderer-primitives-should-own-node-shapes-not-example-markup.md

53.0.62.4 KB
Original Source

V2 renderer primitives should own node shapes not example markup

What happened

Once the browser proofs settled the zero-width policy, the remaining v2 proof surfaces were still hand-writing the low-level DOM contract:

  • data-slate-node="text"
  • data-slate-leaf
  • data-slate-node="element"
  • data-slate-spacer

That is not a proof anymore. That is a renderer layer pretending not to be one.

What fixed it

slate-react-v2 now owns the minimal renderer primitives directly:

The v2 proof surfaces and matrix routes now consume those primitives instead of restating the DOM shape by hand.

Why this works

The browser proofs were valuable because they identified which DOM details were real contracts and which were accidental.

Once that line is clear, the right move is not to keep copy-pasting the “good” markup into examples. The right move is to package the good markup into the smallest reusable renderer stack and make examples depend on that.

That gives v2 a real renderer/input layer instead of a pile of increasingly clever demo files.

Reusable rule

For slate-react-v2:

  • if a DOM shape is required by more than one proof surface, it belongs in a package primitive
  • examples should prove package primitives, not replace them

Proof files are where you discover renderer contracts. They are not where renderer contracts should keep living forever.