fix(app): guard comment accessor in message timeline (#17126)

This commit is contained in:
Luke Parker
2026-03-12 13:55:16 +10:00
committed by GitHub
parent b1ef501207
commit db7bafe917
@@ -778,31 +778,35 @@ export function MessageTimeline(props: {
<div class="flex w-max min-w-full justify-end gap-2"> <div class="flex w-max min-w-full justify-end gap-2">
<Index each={comments()}> <Index each={comments()}>
{(commentAccessor: () => MessageComment) => { {(commentAccessor: () => MessageComment) => {
const comment = createMemo(() => commentAccessor()) const comment = createMemo(() => commentAccessor())
return ( return (
<div class="shrink-0 max-w-[260px] rounded-[6px] border border-border-weak-base bg-background-stronger px-2.5 py-2"> <Show when={comment()}>
<div class="flex items-center gap-1.5 min-w-0 text-11-medium text-text-strong"> {(c) => (
<FileIcon <div class="shrink-0 max-w-[260px] rounded-[6px] border border-border-weak-base bg-background-stronger px-2.5 py-2">
node={{ path: comment().path, type: "file" }} <div class="flex items-center gap-1.5 min-w-0 text-11-medium text-text-strong">
class="size-3.5 shrink-0" <FileIcon
/> node={{ path: c().path, type: "file" }}
<span class="truncate">{getFilename(comment().path)}</span> class="size-3.5 shrink-0"
<Show when={comment().selection}> />
{(selection) => ( <span class="truncate">{getFilename(c().path)}</span>
<span class="shrink-0 text-text-weak"> <Show when={c().selection}>
{selection().startLine === selection().endLine {(selection) => (
? `:${selection().startLine}` <span class="shrink-0 text-text-weak">
: `:${selection().startLine}-${selection().endLine}`} {selection().startLine === selection().endLine
</span> ? `:${selection().startLine}`
)} : `:${selection().startLine}-${selection().endLine}`}
</Show> </span>
</div> )}
<div class="pt-1 text-12-regular text-text-strong whitespace-pre-wrap break-words"> </Show>
{comment().comment} </div>
</div> <div class="pt-1 text-12-regular text-text-strong whitespace-pre-wrap break-words">
</div> {c().comment}
) </div>
}} </div>
)}
</Show>
)
}}
</Index> </Index>
</div> </div>
</div> </div>