fix: waveform not rendering on voice messages after thread switch
The call wave sync watcher fired before DOM was updated (flush: 'pre'), so ref callbacks hadn't registered host elements yet. Changed to flush: 'post' so WaveSurfer instances are created after DOM refs exist. Also fixed getCallItem to read from clientTimelineItems (source of truth) instead of visibleThreadItems which could be stale. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -588,7 +588,7 @@ const threadStreamItems = computed(() => {
|
||||
return rows.sort((a, b) => a.at.localeCompare(b.at));
|
||||
});
|
||||
|
||||
// Sync call waves when thread stream changes
|
||||
// Sync call waves when thread stream changes (flush: 'post' ensures DOM refs are registered)
|
||||
watch(
|
||||
() => threadStreamItems.value.map((entry: any) => `${entry.kind}:${entry.id}`).join("|"),
|
||||
() => {
|
||||
@@ -597,10 +597,15 @@ watch(
|
||||
.filter((entry: any) => entry.kind === "call")
|
||||
.map((entry: any) => entry.item.id as string),
|
||||
);
|
||||
const getCallItem = (id: string) =>
|
||||
visibleThreadItems.value.find((item) => item.id === id && item.kind === "call");
|
||||
const getCallItem = (id: string) => {
|
||||
const timelineItem = clientTimelineItems.value.find(
|
||||
(entry) => entry.contentType === "message" && entry.message?.id === id && entry.message?.kind === "call",
|
||||
);
|
||||
return timelineItem?.message ?? undefined;
|
||||
};
|
||||
void _syncCommCallWavesRaw(activeCallIds, getCallItem);
|
||||
},
|
||||
{ flush: "post" },
|
||||
);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user