Skip to content

Commit dff6ca8

Browse files
committed
fix(mates): restore mention indicator state across view switches and DOM rebuilds
Track active mention mateId server-side and re-send mention_processing on session switch. Cache mention-active state client-side so renderUserStrip DOM rebuilds preserve the processing dot and blink animation.
1 parent 46aaf28 commit dff6ca8

5 files changed

Lines changed: 1507 additions & 5 deletions

File tree

lib/project-mate-interaction.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ function attachMateInteraction(ctx) {
445445
}
446446

447447
session._mentionInProgress = true;
448+
session._mentionActiveMateId = msg.mateId;
448449

449450
// Send mention start indicator
450451
sendToSession(session.localId, {
@@ -478,6 +479,7 @@ function attachMateInteraction(ctx) {
478479
},
479480
onDone: function (fullText) {
480481
session._mentionInProgress = false;
482+
session._mentionActiveMateId = null;
481483

482484
// Save mention response to session history
483485
var mentionResponseEntry = {
@@ -512,6 +514,7 @@ function attachMateInteraction(ctx) {
512514
},
513515
onError: function (errMsg) {
514516
session._mentionInProgress = false;
517+
session._mentionActiveMateId = null;
515518
// Clean up dead session
516519
if (session._mentionSessions && session._mentionSessions[msg.mateId]) {
517520
delete session._mentionSessions[msg.mateId];
@@ -610,6 +613,7 @@ function attachMateInteraction(ctx) {
610613
}
611614
}).catch(function (err) {
612615
session._mentionInProgress = false;
616+
session._mentionActiveMateId = null;
613617
console.error("[mention] Failed to create session for mate " + msg.mateId + ":", err.message || err);
614618
sendToSession(session.localId, { type: "mention_error", mateId: msg.mateId, error: "Failed to create mention session." });
615619
});

lib/project.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ function createProjectContext(opts) {
624624
delete session._mentionSessions[mateId];
625625
}
626626
session._mentionInProgress = false;
627+
session._mentionActiveMateId = null;
627628
sendToSession(session.localId, { type: "mention_done", mateId: mateId, stopped: true });
628629
send({ type: "mention_processing", mateId: mateId, active: false });
629630
}

0 commit comments

Comments
 (0)