From c75c6497d4612a7668a2c9450ceb4fc143f5f681 Mon Sep 17 00:00:00 2001 From: Yunfei He Date: Mon, 8 Jun 2026 19:55:16 +0800 Subject: [PATCH] docs(divergences): correct Ink behavior in display-reset and react-concurrent Verified against real Ink v7.0.4 (react 19.2) instead of source-reading: - display-reset: Ink does not "persist" a withdrawn `display`. Its diff emits a removed key as `display: undefined`, and applyDisplayStyles sets DISPLAY_NONE for any non-`'flex'` value, so clearing a previously set `display` hides the box (verified: flex -> removed goes visible -> hidden). Describe the real behavior and the common-toggle consequence. - react-concurrent: drop "Suspense" from the React-only list. Vue ships a built-in ``; the genuine gap is interruptible concurrent rendering / `useTransition`. Co-Authored-By: Claude Opus 4.8 (1M context) --- .agents/docs/ink-divergences.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.agents/docs/ink-divergences.md b/.agents/docs/ink-divergences.md index 0ebdfc8..70ca89f 100644 --- a/.agents/docs/ink-divergences.md +++ b/.agents/docs/ink-divergences.md @@ -224,7 +224,8 @@ current-props model, or API conventions. #### React concurrent mode -- **Ink:** built on React; Suspense / `useTransition` are React features. +- **Ink:** built on React; `useTransition` and interruptible concurrent rendering are + React features. - **vue-tui:** no equivalent. - **Why:** this is a React-only concept with no Vue equivalent, so it is N/A rather than a parity gap. @@ -245,10 +246,14 @@ current-props model, or API conventions. #### Removing `display` resets to the default (visible) -- **Ink:** `applyDisplayStyles` (`styles.ts`) sets `DISPLAY_NONE` whenever an explicit - `display` is present and not `'flex'`, so a present-but-undefined - `display={undefined}` **hides** the box, and an omitted `display` **persists** the prior - value. +- **Ink:** `applyDisplayStyles` (`styles.ts`) calls `setDisplay(DISPLAY_NONE)` whenever the + 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 + `'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 + never set `display` is a no-op and stays visible — the diff registers no change.) 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` (visible): the same state as if the prop had never been set. - **Why:** render = f(current props): no `display` set means the default (visible).