fix: timeline events use kind not type, guard .length, fix field names
Author: Aaron Steven White
Commit
487f747c098acf1c732ee18e22fda1c5a4c69558Parent: b4f15f0cef
Structural diff unavailable
These commits were pushed via plain git push, so no pre-parsed
schemas are available. Install git-remote-cospan and re-push via panproto:// to
see scope-level changes, breaking change detection, and semantic diffs.
brew install panproto/tap/git-remote-cospan3 files changed +15 -23
@@ -3,11 +3,11 @@
33 import { timeAgo } from '$lib/utils/time.js'; 44 55 interface TimelineEvent { 6- type: 'comment' | 'stateChange'; 7- data: Record<string, any>; 6+ kind: 'comment' | 'stateChange'; 7+ [key: string]: unknown; 88 } 99 10- let { events }: { events: TimelineEvent[] } = $props(); 10+ let { events = [] }: { events: TimelineEvent[] } = $props(); 1111 </script> 1212 1313 {#if events.length === 0}
@@ -15,40 +15,31 @@
1515 {:else} 1616 <div class="space-y-4"> 1717 {#each events as event} 18- {#if event.type === 'comment'} 18+ {#if event.kind === 'comment'} 1919 <div class="rounded-lg border border-border bg-surface-1"> 2020 <div class="flex items-center gap-2 border-b border-border px-4 py-2"> 21- <span class="text-sm font-medium text-text-primary"> 22- {event.data.creatorHandle ?? event.data.creatorDid} 23- </span> 2421 <span class="text-xs text-text-secondary"> 25- commented {timeAgo(event.data.createdAt)} 22+ commented {timeAgo(String(event.createdAt ?? ''))} 2623 </span> 2724 </div> 2825 <div class="px-4 py-3 text-sm text-text-primary whitespace-pre-wrap"> 29- {event.data.body} 26+ {event.body} 3027 </div> 3128 </div> 32- {:else if event.type === 'stateChange'} 29+ {:else if event.kind === 'stateChange'} 3330 <div class="flex items-center gap-2 py-2 text-sm"> 3431 <div class="h-px flex-1 bg-border"></div> 3532 <span class="flex items-center gap-2 text-text-secondary"> 36- <span class="font-medium text-text-primary"> 37- {event.data.actorHandle ?? event.data.actorDid} 38- </span> 39- {#if event.data.state === 'closed'} 33+ {#if event.state === 'closed'} 4034 closed this 4135 {:else} 4236 reopened this 4337 {/if} 44- <StateBadge state={event.data.state} /> 45- <span class="text-xs">{timeAgo(event.data.createdAt)}</span> 38+ <StateBadge state={String(event.state ?? 'open')} /> 39+ <span class="text-xs">{timeAgo(String(event.createdAt ?? ''))}</span> 4640 </span> 4741 <div class="h-px flex-1 bg-border"></div> 4842 </div> 49- {#if event.data.reason} 50- <p class="ml-8 text-xs text-text-secondary">{event.data.reason}</p> 51- {/if} 5243 {/if} 5344 {/each} 5445 </div>
@@ -6,16 +6,17 @@ export const load: PageServerLoad = async ({ params }) => {
66 try { 77 const issue = await getIssue({ did: params.did, repo: params.repo, rkey: params.rkey }); 88 9- let timeline = { events: [] as any[], cursor: null as string | null }; 9+ let timelineEvents: Record<string, unknown>[] = []; 1010 try { 11- timeline = await getIssueTimeline({ did: params.did, repo: params.repo, rkey: params.rkey, limit: 50 }); 11+ const tl = await getIssueTimeline({ did: params.did, repo: params.repo, rkey: params.rkey, limit: 50 }); 12+ timelineEvents = tl.timeline ?? []; 1213 } catch {} 1314 1415 return { 1516 did: params.did, 1617 repo: params.repo, 1718 issue, 18- timeline 19+ timelineEvents 1920 }; 2021 } catch (err) { 2122 console.error(
@@ -55,6 +55,6 @@
5555 </div> 5656 {/if} 5757 58-<Timeline events={data.timeline.events} /> 58+<Timeline events={data.timelineEvents} /> 5959 6060 <BackLink href="{basePath}/issues" label="Back to issues" />