From 9b6e8291feb798d97eb14fdaee3118431dc9c556 Mon Sep 17 00:00:00 2001 From: Ruslan Bakiev <572431+veikab@users.noreply.github.com> Date: Wed, 25 Feb 2026 08:17:17 +0700 Subject: [PATCH] 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 --- frontend/app/components/workspace/CrmWorkspaceApp.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/app/components/workspace/CrmWorkspaceApp.vue b/frontend/app/components/workspace/CrmWorkspaceApp.vue index d5d236e..88477e8 100644 --- a/frontend/app/components/workspace/CrmWorkspaceApp.vue +++ b/frontend/app/components/workspace/CrmWorkspaceApp.vue @@ -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" }, ); // ---------------------------------------------------------------------------