docs(divergences): reframe second-mount no-op as an intentional, blessed divergence (#136)

A second mount() on a live stdout stays a warn + no-op (no behavior change).
This reframes it as a deliberate, maintainer-blessed choice instead of the
vaguely-justified entry it was.

- warning (render.ts): rewrite the stderr message to state the situation plus
  the two recovery paths (update reactive state, or unmount() the existing app
  first), replacing the old "unsupported / call unmount() first" phrasing.
- divergence doc: rewrite the Why with the real rationale (it is a misuse path;
  Ink warns it is unsupported too; vue-tui fails safe by keeping the live app
  and warning; there is no clean public path to Ink's reuse-and-rerender under
  the createApp model). Move the entry from "Vue-Idiomatic Choices" to
  "Intentional Divergence Choices"; record "Maintainer decision: KEEP"; tighten
  the inert-handle wording (unmount() only settles its own exit promise).
- tests: retarget the instance-reuse-guard assertions to the new warning text,
  including a negative assertion that previously matched a stale substring.

Verified: vp run ready (integration 1104 + PTY 123 passing, lint/type/build).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yunfei He
2026-06-04 19:17:53 +08:00
committed by GitHub
parent 929f3952bb
commit 5d071d44ab
3 changed files with 23 additions and 23 deletions
@@ -49,9 +49,7 @@ test("warn + skip wiring when mount() is called on an already-live stdout", asyn
// (a) A warning containing the key phrase was written to process.stderr.
stderrSpy.mockRestore();
expect(stderrWrites.join("")).toContain(
"createApp()/mount() was called again for the same stdout before the previous Vue TUI instance was unmounted",
);
expect(stderrWrites.join("")).toContain("this stdout already has a live app");
// (b) The second mount did NOT wire a second renderer: no additional writes
// to stdout happened immediately after the second mount (the second app
@@ -96,9 +94,7 @@ test("warn + skip wiring when mount() is called on an already-live stdout", asyn
const app3 = createApp(App);
app3.mount({ stdout, stdin, stderr: process.stderr, interactive: false });
thirdSpy.mockRestore();
expect(thirdWrites.join("")).toContain(
"createApp()/mount() was called again for the same stdout before the previous Vue TUI instance was unmounted",
);
expect(thirdWrites.join("")).toContain("this stdout already has a live app");
// Cleanup: app1 still owns the stream; unmount it cleanly.
app1.unmount();
@@ -128,7 +124,7 @@ test("unmounting first app allows a subsequent mount on the same stdout (no warn
stderrSpy.mockRestore();
const warnText = stderrWrites.join("");
expect(warnText).not.toContain("createApp()/mount() was called again for the same stdout");
expect(warnText).not.toContain("this stdout already has a live app");
// app2 renders cleanly.
await app2.waitUntilRenderFlush();