Skip to content

Commit 251b949

Browse files
authored
0.237.006 (#676)
* Update chat-sidebar-conversations.js * 0.237.006
1 parent 534eb72 commit 251b949

3 files changed

Lines changed: 26 additions & 4 deletions

File tree

application/single_app/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
EXECUTOR_TYPE = 'thread'
8989
EXECUTOR_MAX_WORKERS = 30
9090
SESSION_TYPE = 'filesystem'
91-
VERSION = "0.237.005"
91+
VERSION = "0.237.006"
9292

9393

9494
SECRET_KEY = os.getenv('SECRET_KEY', 'dev-secret-key-change-in-production')

application/single_app/static/js/chat/chat-sidebar-conversations.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,23 @@ function createSidebarConversationItem(convo) {
143143
const originalTitleElement = headerRow ? headerRow.querySelector('.sidebar-conversation-title') : null;
144144

145145
if (headerRow && dropdownElement && originalTitleElement) {
146+
// Verify the dropdown is actually a child of headerRow before attempting manipulation
147+
if (!headerRow.contains(dropdownElement)) {
148+
console.error('Dropdown element is not a child of headerRow', { headerRow, dropdownElement });
149+
return convoItem;
150+
}
151+
146152
const titleWrapper = document.createElement('div');
147153
titleWrapper.classList.add('sidebar-conversation-header', 'd-flex', 'align-items-center', 'flex-grow-1', 'overflow-hidden', 'gap-2');
148154

149-
// Insert the wrapper before the dropdown first
150-
headerRow.insertBefore(titleWrapper, dropdownElement);
155+
// Remove the original title from headerRow
156+
originalTitleElement.remove();
151157

152-
// Now move the title element into the wrapper
158+
// Add styling to title
153159
originalTitleElement.classList.add('flex-grow-1', 'text-truncate');
154160
originalTitleElement.style.minWidth = '0';
161+
162+
// Add title to wrapper
155163
titleWrapper.appendChild(originalTitleElement);
156164

157165
const isGroupConversation = (convo.chat_type && convo.chat_type.startsWith('group')) || groupName;
@@ -162,6 +170,9 @@ function createSidebarConversationItem(convo) {
162170
badge.title = groupName ? `Group conversation: ${groupName}` : 'Group conversation';
163171
titleWrapper.appendChild(badge);
164172
}
173+
174+
// Insert the wrapper before the dropdown
175+
headerRow.insertBefore(titleWrapper, dropdownElement);
165176
}
166177

167178
// Add double-click editing to title

docs/explanation/release_notes.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
<!-- BEGIN release_notes.md BLOCK -->
22
# Feature Release
33

4+
### **(v0.237.006)**
5+
6+
#### Bug Fixes
7+
8+
* **Sidebar Conversations DOM Manipulation Fix**
9+
* Fixed JavaScript error "Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node" that prevented sidebar conversations from loading.
10+
* **Root Cause**: In `createSidebarConversationItem()`, the code was attempting DOM manipulation in the wrong order. When `originalTitleElement` was appended to `titleWrapper`, it was removed from `headerRow`, making the subsequent `insertBefore(titleWrapper, dropdownElement)` fail because `dropdownElement` was no longer a valid child reference in the expected DOM position.
11+
* **Impact**: Users experienced a complete failure loading the sidebar conversation list, with the error appearing in browser console and preventing any conversations from displaying in the sidebar. This affected all users attempting to view their conversation history.
12+
* **Solution**: Reordered DOM manipulation to remove `originalTitleElement` from DOM first, style it, add it to `titleWrapper`, then insert the complete `titleWrapper` before `dropdownElement`. Added validation to check if `dropdownElement` is a valid child before attempting insertion.
13+
* (Ref: `chat-sidebar-conversations.js`, `createSidebarConversationItem()`, DOM manipulation order, line 150)
14+
415
### **(v0.237.005)**
516

617
#### Bug Fixes

0 commit comments

Comments
 (0)