Refactor UserLinkFromId component to enforce userId type and remove null checks

This commit is contained in:
MartinBraquet
2026-02-18 20:08:32 +01:00
parent aacdd380c4
commit f4f009dc4a
2 changed files with 2 additions and 3 deletions

View File

@@ -107,7 +107,7 @@ export function EventCard(props: {
</p>
{event.participants.length > 0 && (
<div className="flex flex-wrap gap-1 mt-2">
{event.participants.map((participantId: any) => (
{event.participants.map((participantId: string) => (
<span key={participantId} className="bg-canvas-100 text-ink-700 px-2 py-1 rounded text-xs">
<UserLinkFromId userId={participantId}/>
</span>

View File

@@ -32,10 +32,9 @@ export function UserLink({user, className = ""}: {
}
export function UserLinkFromId({userId, className = ""}: {
userId: string | null | undefined
userId: string
className?: string
}) {
if (!userId) return null
const user = useUserInStore(userId)
return <UserLink user={user} className={className}/>
}