fix(chat): critical 0.0.4 fixes + marked required peer#163
Merged
Conversation
…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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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.
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.
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:
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
🤖 Generated with Claude Code