mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-07-13 12:38:02 +00:00
fix: prevent document link click from resetting active session (#2055)
* fix: prevent document link click from resetting active session Clicking a #document-<uuid> link in chat caused the session to reset because of two issues: 1. chatRenderer.js: clicking on the text inside an <a> yields a Text node target whose .closest() is undefined, so preventDefault never fires and the browser performs a default hash-navigation 2. sessions.js: the hashchange handler treated the entity hash (document-<uuid>) as a session lookup, found no match, and the subsequent loadSessions created a new default-model chat Fix: walk past Text nodes before calling .closest(), and skip entity-prefixed hashes in the hashchange handler. Fixes #2035 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(documents): move isOpen=true after container check in openPanel isOpen was set to true before the #chat-container existence check. If the container was missing during a race, the function returned early but isOpen stayed true, preventing the panel from ever reopening on subsequent calls. Move isOpen=true to after the container guard so a failed open doesn't leave the flag stuck. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3728,6 +3728,9 @@ import * as Modals from './modalManager.js';
|
||||
_minimizedDocId = null;
|
||||
Modals.unregister('doc-panel');
|
||||
}
|
||||
const container = document.getElementById('chat-container');
|
||||
if (!container) return;
|
||||
|
||||
isOpen = true;
|
||||
// Doc was opened last → it goes in front of the email windows (clears the
|
||||
// email-front flag; the doc/email z-index alternation lives in CSS).
|
||||
@@ -3735,9 +3738,6 @@ import * as Modals from './modalManager.js';
|
||||
_ensureAgentMode();
|
||||
_markDocVisibleState(_lastSessionId, 'open');
|
||||
|
||||
const container = document.getElementById('chat-container');
|
||||
if (!container) return;
|
||||
|
||||
document.body.classList.add('doc-view');
|
||||
|
||||
// Sync toggle button state
|
||||
|
||||
Reference in New Issue
Block a user