Skip to content

Commit 1e9db0c

Browse files
committed
feat: migrate feed views to composite components with slot support
- Add feed.composites.tsx with createFeedTimelineComposite and createFeedDetailComposite - Timeline and detail views now use CompositeComponent with renderActions slot - Admin actions wired through slots for client-side interactivity - Table view retains contentRsc approach (too interactive for composites) - Simplify feed.$id route by moving shell markup to server composite
1 parent caa303f commit 1e9db0c

File tree

5 files changed

+707
-584
lines changed

5 files changed

+707
-584
lines changed

src/components/FeedEntry.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { ReactNode } from 'react'
2+
import type { AnyCompositeComponent } from '@tanstack/react-start/rsc'
23
import { format, formatDistanceToNow } from '~/utils/dates'
34
import { libraries } from '~/libraries'
45
import { partners } from '~/utils/partners'
@@ -18,14 +19,17 @@ export interface FeedEntry {
1819
publishedAt: number
1920
createdAt: number
2021
updatedAt?: number
21-
metadata?: any
22+
metadata?: Record<string, string | number | boolean | null | undefined>
2223
libraryIds: string[]
2324
partnerIds?: string[]
2425
tags: string[]
2526
showInFeed: boolean
2627
featured?: boolean
2728
autoSynced: boolean
2829
lastSyncedAt?: number
30+
// Composite sources for RSC rendering
31+
timelineCompositeSrc?: AnyCompositeComponent
32+
detailCompositeSrc?: AnyCompositeComponent
2933
}
3034

3135
interface FeedEntryProps {
@@ -160,12 +164,18 @@ export function FeedEntry({
160164
const releaseLevelBadge = getReleaseLevelBadge()
161165

162166
// Determine external link if available
163-
const getExternalLink = () => {
167+
const getExternalLink = (): string | null => {
164168
if (entry.metadata) {
165-
if (entry.entryType === 'release' && entry.metadata.url) {
169+
if (
170+
entry.entryType === 'release' &&
171+
typeof entry.metadata.url === 'string'
172+
) {
166173
return entry.metadata.url
167174
}
168-
if (entry.entryType === 'blog' && entry.metadata.url) {
175+
if (
176+
entry.entryType === 'blog' &&
177+
typeof entry.metadata.url === 'string'
178+
) {
169179
return entry.metadata.url
170180
}
171181
}

0 commit comments

Comments
 (0)