fix(voice): merge call store entries so cable + message.created races don't drop provider/sdp/caller
This commit is contained in:
@@ -225,6 +225,9 @@ class ActionCableConnector extends BaseActionCableConnector {
|
||||
provider: 'whatsapp',
|
||||
sdpOffer: data.sdp_offer,
|
||||
iceServers: data.ice_servers,
|
||||
// Caller info for the FloatingCallWidget so it doesn't show "Unknown caller"
|
||||
// before the conversation/contact has loaded into the store.
|
||||
caller: data.caller,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ function extractCallData(message) {
|
||||
const call = message?.call || {};
|
||||
return {
|
||||
callSid: call.provider_call_id,
|
||||
callId: call.id,
|
||||
provider: call.provider,
|
||||
status: call.status,
|
||||
callDirection: call.direction === 'outgoing' ? 'outbound' : 'inbound',
|
||||
conversationId: message?.conversation_id,
|
||||
@@ -36,7 +38,7 @@ function extractCallData(message) {
|
||||
export function handleVoiceCallCreated(message, currentUserId) {
|
||||
if (!isVoiceCallMessage(message)) return;
|
||||
|
||||
const { callSid, callDirection, conversationId, senderId } =
|
||||
const { callSid, callId, provider, callDirection, conversationId, senderId } =
|
||||
extractCallData(message);
|
||||
|
||||
if (shouldSkipCall(callDirection, senderId, currentUserId)) return;
|
||||
@@ -44,6 +46,8 @@ export function handleVoiceCallCreated(message, currentUserId) {
|
||||
const callsStore = useCallsStore();
|
||||
callsStore.addCall({
|
||||
callSid,
|
||||
callId,
|
||||
provider,
|
||||
conversationId,
|
||||
callDirection,
|
||||
senderId,
|
||||
|
||||
Reference in New Issue
Block a user