Skip to content

fix(chat): keep the Preview pill up while streaming, call the panel Preview - #70

Merged
zeekay merged 2 commits into
mainfrom
fix/443-preview-panel
Nov 20, 2026
Merged

zeekay merged 2 commits into
mainfrom
fix/443-preview-panel

Conversation

@zeekay

@zeekay zeekay commented Nov 20, 2026

Copy link
Copy Markdown
Member

PR — hanzoai/app: fix(chat): keep the Preview pill up while streaming, call the panel Preview

Branch: fix/443-preview-panel (based on 358f9e2, @hanzo/app 0.3.100)
Commit: 7550e9a
Work dir: ~/workspace/prs/443/repo/ — fresh depth-1 clone of hanzoai/app, patch applied and re-verified (git apply --check clean).
Status: NOT pushed, NOT opened as a PR. No GitHub auth on this VM — push + gh pr create still need Zach's device-code login (running separately).

Title

fix(chat): keep the Preview pill up while streaming, call the panel Preview

Body

Fixes hanzo-inc/app#443 — after Enso built a landing page on hanzo.app (mobile Safari), it said "The page is live in the Output panel", but Zach could find no Output tab, and asking "What did you build?" left him with no Preview button while the answer streamed.

hanzoai/app main already had a partial fix (about.ts calls the place "the Preview", PreviewButton above the composer, auto-open on build end), but three holes remained:

  1. The build prompt taught the model the wrong name. Chat.tsx demoNote told it the page "renders live in the side-by-side Outputs preview panel" — the literal words Enso then repeated. Now: "opens as the Preview beside the conversation", matching about.ts.
  2. The composer Preview button vanished while an answer streamed (chat.streaming ? null : lastPage(said)). After a build, "What did you build?" starts a long streaming answer, and the per-answer Preview button scrolls away with it — so the one persistent way back to the page was hidden precisely when it was looked for. The guard is dropped; this is safe because written() only returns a fenced block that is closed, and reaches back past answers that wrote none to the last finished page.
  3. The panel itself was called a third name — label={t("Tabs")}, desktop side panel and mobile sheet alike, while the button and about.ts call it "Preview" (and the summary card calls it "Outputs"). Now t("Preview") in both places. Per-tab file names and the "Outputs" summary section are unchanged.

Two new tests in lastpage.test.ts pin the streaming-safety property: an unclosed fence mid-stream returns the earlier finished page; a closed fence in the streaming turn already returns that page.

Tests

Run in a scratch vitest harness (~/workspace/prs/443/harness/, outside the repo — not committed), because this VM has no pnpm and no node_modules in the clone:

  • vitest run src/lastpage.test.ts src/about.test.ts (vitest 3.2.7) — 10 passed, 0 failed: lastpage.test.ts 5/5 (3 pre-existing + 2 new), about.test.ts 5/5 (no regression in the "call it the Preview" wording).
  • esbuild parse of the edited Chat.tsx — clean, no syntax errors.

Caveats, for the reviewer: the harness mocks @hanzo/build exactly as the repo test does, and replaces @hanzo/personas with a minimal front-matter stub (the real team.gen.ts data is copied verbatim). Not run here: full vitest run, tsc --noEmit, or a real mobile render — CI must run those before merging. The demo-prompt wording change has no repo test covering it; it needs a human/CI pass.

Closing #443 — read this before closing

Do not close hanzo-inc/app#443 on this merge alone. This PR changes hanzoai/app; nothing changes on hanzo.app until:

  1. This merges and a new @hanzo/app release is published,
  2. The host (hanzo-inc/app) bumps to that release and deploys hanzo.app,
  3. Someone verifies on a phone, logged in: build a landing page, ask "What did you build?" while it streams, and confirm (a) the model says "Preview", never "Output panel", (b) the Preview pill stays above the composer throughout, (c) the opened sheet is headed "Preview".

Close #443 only when the fix is live on hanzo.app. (Same release-order pattern as hanzoai/ui#327 → host bump.)

To open the PR (once GitHub auth is ready)

cd ~/workspace/prs/443/repo
git push -u origin fix/443-preview-panel
gh pr create --title "fix(chat): keep the Preview pill up while streaming, call the panel Preview" --body-file ~/workspace/prs/443/PR.md

Zach Kelling and others added 2 commits November 20, 2026 22:19
…review

After a build, asking 'What did you build?' streamed an answer with no
Preview button above the composer on a phone — the one persistent way
back to the page was hidden exactly when the person looked for it.
The build prompt also taught the model the wrong name ('side-by-side
Outputs preview panel'), which it then repeated, and the panel itself
was labelled 'Tabs', a third name for the same place.

- Drop the streaming guard on the Preview memo: lastPage only returns
  closed fenced blocks, so a half-written fence is never a page.
- Build prompt now says the page 'opens as the Preview beside the
  conversation', matching about.ts.
- Panel label 'Tabs' -> 'Preview' (desktop side panel + mobile sheet).
- Two new lastpage tests pin the streaming-safety property.

Fixes hanzo-inc/app#443
@zeekay
zeekay merged commit 7ff242d into main Nov 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants