fix: refresh favorites after unfavorite

This commit is contained in:
TerryM
2026-06-05 18:16:33 +08:00
parent 486c09dd39
commit a9ec46e008
5 changed files with 88 additions and 21 deletions

View File

@@ -34,6 +34,7 @@ export function MessageBubble({
post,
fluid = false,
variant = "default",
onFavoriteChange,
}: {
post: Post;
/** When true, fill the parent container instead of applying the standalone
@@ -41,6 +42,7 @@ export function MessageBubble({
fluid?: boolean;
/** Desktop latest-updates cards follow the dedicated Figma masonry design. */
variant?: MessageBubbleVariant;
onFavoriteChange?: (postId: string, favorited: boolean) => void;
}) {
const Bubble = pickBubble(post);
const isVisual =
@@ -71,6 +73,9 @@ export function MessageBubble({
resourceId={post.id}
size="sm"
className="absolute z-20 bottom-4 right-4 shadow-lg shadow-black/30"
onFavoriteChange={(favorited) =>
onFavoriteChange?.(post.id, favorited)
}
/>
) : null}
@@ -95,7 +100,13 @@ export function MessageBubble({
{formatDateTime(post.publishedAt)}
</time>
<div className="flex shrink-0 items-center gap-2">
<FavoriteButton resourceId={post.id} size="sm" />
<FavoriteButton
resourceId={post.id}
size="sm"
onFavoriteChange={(favorited) =>
onFavoriteChange?.(post.id, favorited)
}
/>
{isFileBubble && post.attachments[0] ? (
<BubbleAttachmentDownloadButton
postId={post.id}