Skip to content

Commit db7bafe

Browse files
authored
fix(app): guard comment accessor in message timeline (anomalyco#17126)
1 parent b1ef501 commit db7bafe

1 file changed

Lines changed: 29 additions & 25 deletions

File tree

packages/app/src/pages/session/message-timeline.tsx

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -778,31 +778,35 @@ export function MessageTimeline(props: {
778778
<div class="flex w-max min-w-full justify-end gap-2">
779779
<Index each={comments()}>
780780
{(commentAccessor: () => MessageComment) => {
781-
const comment = createMemo(() => commentAccessor())
782-
return (
783-
<div class="shrink-0 max-w-[260px] rounded-[6px] border border-border-weak-base bg-background-stronger px-2.5 py-2">
784-
<div class="flex items-center gap-1.5 min-w-0 text-11-medium text-text-strong">
785-
<FileIcon
786-
node={{ path: comment().path, type: "file" }}
787-
class="size-3.5 shrink-0"
788-
/>
789-
<span class="truncate">{getFilename(comment().path)}</span>
790-
<Show when={comment().selection}>
791-
{(selection) => (
792-
<span class="shrink-0 text-text-weak">
793-
{selection().startLine === selection().endLine
794-
? `:${selection().startLine}`
795-
: `:${selection().startLine}-${selection().endLine}`}
796-
</span>
797-
)}
798-
</Show>
799-
</div>
800-
<div class="pt-1 text-12-regular text-text-strong whitespace-pre-wrap break-words">
801-
{comment().comment}
802-
</div>
803-
</div>
804-
)
805-
}}
781+
const comment = createMemo(() => commentAccessor())
782+
return (
783+
<Show when={comment()}>
784+
{(c) => (
785+
<div class="shrink-0 max-w-[260px] rounded-[6px] border border-border-weak-base bg-background-stronger px-2.5 py-2">
786+
<div class="flex items-center gap-1.5 min-w-0 text-11-medium text-text-strong">
787+
<FileIcon
788+
node={{ path: c().path, type: "file" }}
789+
class="size-3.5 shrink-0"
790+
/>
791+
<span class="truncate">{getFilename(c().path)}</span>
792+
<Show when={c().selection}>
793+
{(selection) => (
794+
<span class="shrink-0 text-text-weak">
795+
{selection().startLine === selection().endLine
796+
? `:${selection().startLine}`
797+
: `:${selection().startLine}-${selection().endLine}`}
798+
</span>
799+
)}
800+
</Show>
801+
</div>
802+
<div class="pt-1 text-12-regular text-text-strong whitespace-pre-wrap break-words">
803+
{c().comment}
804+
</div>
805+
</div>
806+
)}
807+
</Show>
808+
)
809+
}}
806810
</Index>
807811
</div>
808812
</div>

0 commit comments

Comments
 (0)