fix(app): guard comment accessor in message timeline (#17126)
This commit is contained in:
@@ -780,14 +780,16 @@ export function MessageTimeline(props: {
|
|||||||
{(commentAccessor: () => MessageComment) => {
|
{(commentAccessor: () => MessageComment) => {
|
||||||
const comment = createMemo(() => commentAccessor())
|
const comment = createMemo(() => commentAccessor())
|
||||||
return (
|
return (
|
||||||
|
<Show when={comment()}>
|
||||||
|
{(c) => (
|
||||||
<div class="shrink-0 max-w-[260px] rounded-[6px] border border-border-weak-base bg-background-stronger px-2.5 py-2">
|
<div class="shrink-0 max-w-[260px] rounded-[6px] border border-border-weak-base bg-background-stronger px-2.5 py-2">
|
||||||
<div class="flex items-center gap-1.5 min-w-0 text-11-medium text-text-strong">
|
<div class="flex items-center gap-1.5 min-w-0 text-11-medium text-text-strong">
|
||||||
<FileIcon
|
<FileIcon
|
||||||
node={{ path: comment().path, type: "file" }}
|
node={{ path: c().path, type: "file" }}
|
||||||
class="size-3.5 shrink-0"
|
class="size-3.5 shrink-0"
|
||||||
/>
|
/>
|
||||||
<span class="truncate">{getFilename(comment().path)}</span>
|
<span class="truncate">{getFilename(c().path)}</span>
|
||||||
<Show when={comment().selection}>
|
<Show when={c().selection}>
|
||||||
{(selection) => (
|
{(selection) => (
|
||||||
<span class="shrink-0 text-text-weak">
|
<span class="shrink-0 text-text-weak">
|
||||||
{selection().startLine === selection().endLine
|
{selection().startLine === selection().endLine
|
||||||
@@ -798,9 +800,11 @@ export function MessageTimeline(props: {
|
|||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
<div class="pt-1 text-12-regular text-text-strong whitespace-pre-wrap break-words">
|
<div class="pt-1 text-12-regular text-text-strong whitespace-pre-wrap break-words">
|
||||||
{comment().comment}
|
{c().comment}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
</Show>
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
</Index>
|
</Index>
|
||||||
|
|||||||
Reference in New Issue
Block a user