fix(chat): keep streamed table rows attached#762
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @blove's task in 2m 16s —— View job Code Review
SummaryThe fix is sound: bumping Issues1. Silent customisation regression —
// cacheplane-markdown-views.ts — unchanged lines 59-60
'table-row': MarkdownTableRowComponent,
'table-cell': MarkdownTableCellComponent,And Options:
2. Both MinorStale registry setup in unit test
What looks good
|
| @for (row of bodyRows(); track $index) { | ||
| <chat-md-table-row [node]="row" /> | ||
| <tr class="chat-md-table-row"> | ||
| @for (cell of row.children; track $index) { | ||
| <td class="chat-md-table-cell" [style.text-align]="cell.alignment ?? null"> | ||
| <chat-md-children [parent]="cell" /> | ||
| </td> | ||
| } | ||
| </tr> |
There was a problem hiding this comment.
track $index instead of stable node ID
Both @for loops use track $index. The parser nodes have a stable id field, so tracking by index means Angular tears down and recreates <tr>/<td> DOM nodes whenever a row is inserted before an existing one. During streaming, rows are appended at the tail so this is low-risk in practice — but streaming partial rows can shift a cell's index mid-update.
| @for (row of bodyRows(); track $index) { | |
| <chat-md-table-row [node]="row" /> | |
| <tr class="chat-md-table-row"> | |
| @for (cell of row.children; track $index) { | |
| <td class="chat-md-table-cell" [style.text-align]="cell.alignment ?? null"> | |
| <chat-md-children [parent]="cell" /> | |
| </td> | |
| } | |
| </tr> | |
| @for (row of bodyRows(); track row.id) { | |
| <tr class="chat-md-table-row"> | |
| @for (cell of row.children; track cell.id) { | |
| <td class="chat-md-table-cell" [style.text-align]="cell.alignment ?? null"> | |
| <chat-md-children [parent]="cell" /> | |
| </td> | |
| } | |
| </tr> |
(Same applies to the header @for on line 17: track cell.id.)
Summary
@cacheplane/partial-markdownto0.5.4, which includes the upstream parser fix for finalized active table rows.<tr>,<th>, and<td>elements directly under table sections.Root Cause
The parser could finalize a table row without a trailing pipe outside the active table, and the Angular table view still had custom element hosts in the table layout tree. Together those made the currently streamed row appear detached below the existing table.
Validation
env -u FORCE_COLOR NO_COLOR=1 npx vitest run --config vite.config.mts src/lib/streaming/streaming-markdown.table-stream.spec.ts src/lib/markdown/views/markdown-table.component.spec.ts src/lib/markdown/streaming-table.spec.ts --pool=forks --reporter=verbosenode libs/licensing/scripts/generate-public-key.mjs && env -u FORCE_COLOR NO_COLOR=1 npx nx test chat -- streaming-markdown.table-stream markdown-table.component streaming-table --reporter=dot --pool=forksenv -u FORCE_COLOR NO_COLOR=1 npx nx lint chatenv -u FORCE_COLOR NO_COLOR=1 npx nx build chatUpstream parser PR: cacheplane/cacheplane#23