fix: resolve TagSelector build error and improve component type safety
- Fixed undefined setTags in TagSelector.tsx - Updated TagSelector to use Dexie cache for immediate UI updates - Refined TastingList mapping to satisfy TypeScript interface - Verified fix with a successful production build
This commit is contained in:
@@ -37,6 +37,7 @@ interface Tasting {
|
||||
}
|
||||
}[];
|
||||
user_id: string;
|
||||
isPending?: boolean;
|
||||
}
|
||||
|
||||
interface TastingListProps {
|
||||
@@ -88,7 +89,10 @@ export default function TastingList({ initialTastings, currentUserId, bottleId }
|
||||
bottle_id: p.bottle_id,
|
||||
created_at: p.tasted_at,
|
||||
user_id: currentUserId || '',
|
||||
isPending: true
|
||||
isPending: true,
|
||||
tasting_buddies: [],
|
||||
tasting_sessions: undefined,
|
||||
tasting_tags: []
|
||||
}))
|
||||
];
|
||||
|
||||
@@ -149,7 +153,7 @@ export default function TastingList({ initialTastings, currentUserId, bottleId }
|
||||
}`}>
|
||||
{note.is_sample ? 'Sample' : 'Bottle'}
|
||||
</span>
|
||||
{(note as any).isPending && (
|
||||
{note.isPending && (
|
||||
<div className="bg-amber-100 dark:bg-amber-900/30 text-amber-600 dark:text-amber-400 px-2 py-0.5 rounded-lg text-[10px] font-black uppercase tracking-tighter flex items-center gap-1.5 animate-pulse">
|
||||
<Clock size={10} />
|
||||
Wartet auf Sync...
|
||||
@@ -174,7 +178,7 @@ export default function TastingList({ initialTastings, currentUserId, bottleId }
|
||||
<Calendar size={12} />
|
||||
{new Date(note.created_at).toLocaleDateString('de-DE')}
|
||||
</div>
|
||||
{(!currentUserId || note.user_id === currentUserId) && !(note as any).isPending && (
|
||||
{(!currentUserId || note.user_id === currentUserId) && !note.isPending && (
|
||||
<button
|
||||
onClick={() => handleDelete(note.id, note.bottle_id)}
|
||||
disabled={!!isDeleting}
|
||||
|
||||
Reference in New Issue
Block a user