Skip to content

fix(chat): critical 0.0.4 fixes + marked required peer#163

Merged
blove merged 3 commits into
mainfrom
claude/chat-04
May 1, 2026
Merged

fix(chat): critical 0.0.4 fixes + marked required peer#163
blove merged 3 commits into
mainfrom
claude/chat-04

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented May 1, 2026

Summary

Combines the urgent 0.0.3 → 0.0.4 fixes from #161 (which had divergent history with the squashed redesign) with the marked-peer-dep policy change. Fresh branch from main, cherry-picked clean.

Fixes from the smoke test

  1. Critical — message content never rendered. `` used `` inside `@switch @case` blocks; Angular projection is resolved at view-creation, so projected content never reached the per-role slots. User bubbles + assistant bodies rendered empty. Fix: single root-level `` + role-driven CSS class on the body wrapper. Caret + controls visibility now driven by `data-role` / `data-current` / `data-streaming` host attributes.

  2. Critical — empty state never hid. `[hidden]` attribute overridden by `display: flex`. Fix: explicit `.chat-empty[hidden] { display: none; }` rule + default fallback content for the `[chatEmptyState]` slot.

  3. Critical — input textarea didn't clear on submit. ngModel proxy getter/setter pattern doesn't reactively re-read on signal change. Fix: switch to signal-native `[ngModel]="messageText()" (ngModelChange)="messageText.set($event)"`.

marked policy change

After the smoke test surfaced the unusable plain-text fallback when `marked` is missing, dropping the `peerDependenciesMeta.marked.optional` flag. `marked` is now a required peer; the defense-in-depth fallback stays in `renderMarkdown` for resilience but the install contract is explicit.

Docs updated: install command becomes `npm install @ngaf/chat marked`; peer-deps table marks it Required.

Investigation notes (deferred from smoke test)

Two other deferred issues turned out to be non-bugs after systematic investigation:

  • License-warning console "spam" (6× per page load): the `emitNag` dedupe Set works correctly. There is exactly 1 `console.warn` per page load. The "6" was the preview MCP duplicating each `console.warn` line in its log render × 3 page reloads during testing.
  • `<chat-sidebar [pushContent]="true">` "broken" positioning: was a rendering artifact from the broken-message bug (refactor(website): migrate to shadcn/ui component primitives #1) where the sidebar body was empty during the buggy 0.0.3. Once refactor(website): migrate to shadcn/ui component primitives #1 is fixed the sidebar positions correctly (28rem panel right-edge, content margin-right shift).

Version

`@ngaf/chat` → `0.0.4` (the version bump from #161 is included; no new release for the marked policy change — it bundles into 0.0.4).

Test plan

  • All chat unit tests pass
  • `nx build chat` clean
  • `nx build website` clean
  • Validated end-to-end against fresh-install consumer (no Tailwind, no postcss): user bubble + streaming assistant + empty state + popup mode all render correctly
  • CI green on this PR
  • Tag `v0.0.4` once merged to fire publish workflow

🤖 Generated with Claude Code

blove and others added 3 commits May 1, 2026 15:38
…0.0.4)

Found via fresh-install smoke test against @ngaf/chat@0.0.3. Multiple
critical UX bugs that shipped to npm:

1. Message content never rendered. chat-message used `<ng-content/>`
   inside `@switch @case` blocks; Angular's content projection is
   resolved at view-creation, so projected text/templates never
   reached the per-role slots. Result: empty user bubbles and empty
   assistant bodies. Fix: single root-level `<ng-content/>` slot,
   role-driven CSS class on the body wrapper. Caret + controls
   visibility now driven by `data-streaming` / `data-current` /
   `data-role` host attributes + CSS, not @switch.

2. Empty state had no default content and didn't hide. The
   `[chatEmptyState]` slot in `<chat>` had no fallback, so
   first-time consumers saw a blank tall area. Even worse, the
   `[hidden]` attribute on the empty container was overridden by
   `display: flex` so the empty state stayed visible after
   messages existed. Fix: provide default fallback content in the
   ng-content slot (How can I help? / Ask anything to get started)
   and add `.chat-empty[hidden] { display: none; }` rule.

3. Input textarea didn't clear on submit. The new chat-input pill
   used a getter/setter proxy (messageTextProxy) for ngModel
   two-way binding, but ngModel doesn't reactively re-read
   getters when the underlying signal changes. Setting
   `messageText.set('')` after submit didn't update the textarea.
   Fix: switch to `[ngModel]="messageText()"` +
   `(ngModelChange)="messageText.set($event)"` — signal-native
   binding that updates reactively.

Fixes validated end-to-end against a fresh `ng new` consumer with
no Tailwind, no postcss, no global stylesheet. Embedded mode
renders user bubble + streaming markdown assistant correctly;
popup mode opens with full conversation; empty state shows with
default content and hides cleanly.

Bumps @ngaf/chat to 0.0.4.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Smoke-test investigation: when consumers skipped marked (which the
docs called "optional"), the chat rendered raw markdown source
("## Hello!", "**fake**", etc.) since the fallback only does
HTML-escape + \n→<br>. Unusable.

Decision: marked is now required. The defense-in-depth plain-text
fallback in renderMarkdown stays for resilience but the install
contract is "you ship marked alongside chat."

Updates installation.mdx + quickstart.mdx to reflect the change:
install command becomes \`npm install @ngaf/chat marked\` and the
peer-deps table marks marked as Required.

No version bump — lands as part of the same 0.0.4 patch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cacheplane Ready Ready Preview, Comment May 1, 2026 10:44pm

Request Review

@blove blove merged commit 996008c into main May 1, 2026
14 checks passed
@blove blove deleted the claude/chat-04 branch May 1, 2026 22:45
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.

1 participant