docs(divergences): correct display={undefined} note (Codex review)

An explicit `display={undefined}` is applied as DISPLAY_NONE and hides on
mount (verified against real Ink v7.0.4) — only an omitted `display` stays
visible. The previous parenthetical conflated the two.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yunfei He
2026-06-08 22:42:59 +08:00
parent 7451cd4cd6
commit 9b7e9dfb26
+5 -4
View File
@@ -250,10 +250,11 @@ current-props model, or API conventions.
prop diff carries a `display` that is not `'flex'`, and Ink's reconciler diff emits a prop diff carries a `display` that is not `'flex'`, and Ink's reconciler diff emits a
withdrawn key as `display: undefined`. So clearing a previously-set `display` (`'none'` or withdrawn key as `display: undefined`. So clearing a previously-set `display` (`'none'` or
`'flex'` → removed) **hides** the box: Ink treats the withdrawn prop as `none`, neither `'flex'` → removed) **hides** the box: Ink treats the withdrawn prop as `none`, neither
keeping the prior value nor restoring the default. (`display={undefined}` on a box that keeping the prior value nor restoring the default. (A box that simply **omits** `display`
never set `display` is a no-op and stays visible — the diff registers no change.) In the stays visible — `'display' in style` is false, so no `setDisplay` runs; but an explicit
common toggle `display={hidden ? 'none' : undefined}`, Ink stays hidden on the `undefined` `display={undefined}` is itself applied as `DISPLAY_NONE` and hides, like any non-`'flex'`
branch; you must set `display="flex"` to show it again. value.) In the common toggle `display={hidden ? 'none' : undefined}`, Ink stays hidden on
the `undefined` branch; you must set `display="flex"` to show it again.
- **vue-tui:** a removed/undefined `display` resets to the Box default `DISPLAY_FLEX` - **vue-tui:** a removed/undefined `display` resets to the Box default `DISPLAY_FLEX`
(visible): the same state as if the prop had never been set. (visible): the same state as if the prop had never been set.
- **Why:** render = f(current props): no `display` set means the default (visible). - **Why:** render = f(current props): no `display` set means the default (visible).