mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 16:00:58 +00:00
Fix SessionListDialog behavior and document PersistentStorageDialog bug
- Fix SessionListDialog to not reload when user selects a session after deleting others - Track if dialog closed via selection vs other means - Only call delete callback if not closed via selection - Batch deletions to avoid reload on every delete - Comment out PersistentStorageDialog in both web-ui example and browser extension (TODO: fix) - Add Known Bugs section to both README.md files documenting PersistentStorageDialog issue - Clean up navigation tracking variable names in browser extension
This commit is contained in:
parent
2d68594711
commit
5f04960f6d
5 changed files with 94 additions and 25 deletions
|
|
@ -12,6 +12,8 @@ export class SessionListDialog extends DialogBase {
|
|||
|
||||
private onSelectCallback?: (sessionId: string) => void;
|
||||
private onDeleteCallback?: (sessionId: string) => void;
|
||||
private deletedSessions = new Set<string>();
|
||||
private closedViaSelection = false;
|
||||
|
||||
protected modalWidth = "min(600px, 90vw)";
|
||||
protected modalHeight = "min(700px, 90vh)";
|
||||
|
|
@ -57,16 +59,26 @@ export class SessionListDialog extends DialogBase {
|
|||
await storage.sessions.deleteSession(sessionId);
|
||||
await this.loadSessions();
|
||||
|
||||
// Notify callback that session was deleted
|
||||
if (this.onDeleteCallback) {
|
||||
this.onDeleteCallback(sessionId);
|
||||
}
|
||||
// Track deleted session
|
||||
this.deletedSessions.add(sessionId);
|
||||
} catch (err) {
|
||||
console.error("Failed to delete session:", err);
|
||||
}
|
||||
}
|
||||
|
||||
override close() {
|
||||
super.close();
|
||||
|
||||
// Only notify about deleted sessions if dialog wasn't closed via selection
|
||||
if (!this.closedViaSelection && this.onDeleteCallback && this.deletedSessions.size > 0) {
|
||||
for (const sessionId of this.deletedSessions) {
|
||||
this.onDeleteCallback(sessionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private handleSelect(sessionId: string) {
|
||||
this.closedViaSelection = true;
|
||||
if (this.onSelectCallback) {
|
||||
this.onSelectCallback(sessionId);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue