From ac3e6bf3f0447e8c044b571952ab53c5f61a0531 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 15 Sep 2026 19:59:29 +0200 Subject: [PATCH] fix: the assistant page finishes loading for non-admin accounts The download-transcript button is removed for anyone who is not an admin, but the event binder still called addEventListener on it unguarded. The throw stopped the binder before the saved-chat list loaded, before the click handler for opening old chats was registered, and before the send box was fully wired, so a non-admin saw no chats until New chat, could not open old ones, and could not chat. The button is now bound only if present. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016fZGJNyDvERbMgS2Uc2msP --- public/js/clinicalAssistant.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/js/clinicalAssistant.js b/public/js/clinicalAssistant.js index f088da96..ba096c67 100644 --- a/public/js/clinicalAssistant.js +++ b/public/js/clinicalAssistant.js @@ -364,7 +364,9 @@ import { if (layout) layout.classList.remove('mobile-chats-open'); // back to the chat clearConversation(ev); }); - document.getElementById('btn-assistant-download-chat').addEventListener('click', downloadTranscript); + // Removed before this runs for anyone who is not an admin, so it may be gone. + var downloadChatBtn = document.getElementById('btn-assistant-download-chat'); + if (downloadChatBtn) downloadChatBtn.addEventListener('click', downloadTranscript); if (input) { input.addEventListener('input', updateConversationBudget); input.addEventListener('input', resizeAssistantInput);