mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 19:38:46 -05:00
[PR #23455] fix: handle orphan messages in chat history to prevent UI deadlock #50252
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/23455
Author: @weyseing
Created: 4/6/2026
Status: 🔄 Open
Base:
dev← Head:fix/orphan-message-deadlock📝 Commits (1)
eae3d57fix: handle orphan messages in chat history to prevent UI deadlock📊 Changes
1 file changed (+29 additions, -2 deletions)
View changed files
📝
src/lib/components/chat/Messages.svelte(+29 -2)📄 Description
Summary
id,role, orparentId) inhistory.messagescause the UI to hang forever on a loading spinner when opening the chatRoot Cause
Three issues in
src/lib/components/chat/Messages.svelte:Infinite spinner — The "load more" check
messages.at(0)?.parentId !== nulluses strict equality. Orphan messages with missingparentId(undefined) pass this check (undefined !== nullistrue), showing the loader forever.Broken tree traversal — Same strict
!== nullcheck inbuildMessages()when walking the parent chain.Blank page — When
currentIdpoints to an orphan,buildMessages()can only reach the orphan (no parent chain to valid messages), rendering nothing useful.Fix
!== null→!= nullsoundefinedandnullboth mean "root message"buildMessages()parent chain walkcurrentIdfindLastValidMessageId()— whencurrentIdpoints to invalid message, scan for the latest valid one and switch to itSteps to Reproduce (before fix)
id/role/parentIdinhistory.messages, andcurrentIdpointing to it)Test JSON for reproduction
Testing
Fixes #15189
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.