mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-02 21:49:42 +02:00
fix(ui): prevent duplicate loop completion notifications
Add deduplication guard to prevent spamming the same completion toast. Uses a Set to track shown completions per session, with 30s expiry to allow re-notification if loop restarts. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -498,6 +498,18 @@ class ClaudemanApp {
|
||||
|
||||
this.eventSource.addEventListener('session:innerCompletionDetected', (e) => {
|
||||
const data = JSON.parse(e.data);
|
||||
// Prevent duplicate notifications for the same completion
|
||||
const completionKey = `${data.sessionId}:${data.phrase}`;
|
||||
if (this._shownCompletions?.has(completionKey)) {
|
||||
return;
|
||||
}
|
||||
if (!this._shownCompletions) {
|
||||
this._shownCompletions = new Set();
|
||||
}
|
||||
this._shownCompletions.add(completionKey);
|
||||
// Clear after 30 seconds to allow re-notification if loop restarts
|
||||
setTimeout(() => this._shownCompletions?.delete(completionKey), 30000);
|
||||
|
||||
this.showToast(`Loop completed: ${data.phrase}`, 'success');
|
||||
// Update inner state to mark loop as inactive
|
||||
const existing = this.innerStates.get(data.sessionId) || {};
|
||||
|
||||
Reference in New Issue
Block a user