fix(intervention): clear stale voice cue/message on new card and dismiss

voiceCue and hermes were never reset, so a new intervention card could show the previous one's spoken line. Clear both when a COLLISION arrives and on respond(); safe against the reliable publish order COLLISION -> HERMES_MESSAGE -> VOICE_CUE.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Kartikeya
2026-06-28 10:34:21 -07:00
parent 79620bccaa
commit faa9769470
+7
View File
@@ -39,6 +39,11 @@ export function useInterventions(room: Room | null) {
if (msg.type === 'COLLISION') { if (msg.type === 'COLLISION') {
setActive(msg.intervention); setActive(msg.intervention);
setActionUrl(null); setActionUrl(null);
// Clear the prior intervention's cue/message so a new card never shows a
// stale voice line. The fresh ones arrive right after on the same
// reliable channel (ordered: COLLISION -> HERMES_MESSAGE -> VOICE_CUE).
setVoiceCue(null);
setHermes(null);
} }
if (msg.type === 'HERMES_MESSAGE') setHermes(msg.message); if (msg.type === 'HERMES_MESSAGE') setHermes(msg.message);
if (msg.type === 'VOICE_CUE') { if (msg.type === 'VOICE_CUE') {
@@ -79,6 +84,8 @@ export function useInterventions(room: Room | null) {
{ reliable: true, topic: DATA_TOPIC }, { reliable: true, topic: DATA_TOPIC },
); );
setActive(null); setActive(null);
setVoiceCue(null);
setHermes(null);
return status; return status;
}, },
[active, room], [active, room],