dify - 💡(How to fix) Fix BUG: Chat history disappears when switching between conversations (regression in v1.13.3+) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langgenius/dify#34801Fetched 2026-04-09 08:17:51
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
1
Assignees
Timeline (top)
assigned ×1commented ×1labeled ×1mentioned ×1
RAW_BUFFERClick to expand / collapse

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.13.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

This issue was previously reported in #29820 and #30378 (both CLOSED), but the bug persists.

Exact reproduction steps:

  1. Open a chat app (Conversation A) in a private/incognito browser
  2. Send 2 messages to Conversation A
  3. Create a new chat (Conversation B)
  4. Send 1 message to Conversation B
  5. Switch back to Conversation A
  6. Send 1 more message to Conversation A
  7. Select Conversation B, then switch back to Conversation A
  8. Result: The latest message sent in Conversation A (step 6) disappears from the UI

Additional observation:

  • If you select Conversation B again without doing anything, then switch back to A, the message reappears
  • This indicates the message exists in the backend but the frontend state is lost

✔️ Expected Behavior

Display the conversation history correctly and maintain the latest messages when switching between conversations.

❌ Actual Behavior

The most recent message disappears from the UI when switching conversations, only to reappear after switching away and back again.

https://github.com/user-attachments/assets/039b32b1-5d5c-41f0-99bb-dc9f942600a9

extent analysis

TL;DR

The issue can be mitigated by ensuring that the conversation state is properly updated when switching between conversations, potentially by re-fetching the conversation history or updating the frontend state.

Guidance

  • Verify that the backend API is correctly returning the latest messages for Conversation A after step 6, to confirm that the issue is indeed with the frontend state.
  • Check the code responsible for updating the conversation history in the frontend, to ensure that it is correctly handling the case where a new message is sent to Conversation A after switching away and back.
  • Investigate the use of any caching or optimization mechanisms that may be causing the frontend state to become outdated.
  • Consider adding logging or debugging statements to track the conversation state and identify where it is being lost.

Example

No specific code snippet can be provided without more information about the implementation, but an example of how to re-fetch the conversation history when switching conversations might look like:

// Pseudo-code example
whenConversationSwitched() {
  // Re-fetch the conversation history from the backend
  fetchConversationHistory(conversationId)
    .then((history) => {
      // Update the frontend state with the latest conversation history
      updateConversationState(history);
    });
}

Notes

The issue seems to be related to the frontend state management, and the provided information suggests that the backend is correctly storing the messages. However, without more information about the implementation, it is difficult to provide a more specific solution.

Recommendation

Apply a workaround to re-fetch the conversation history when switching conversations, as this seems to be the most straightforward way to ensure that the frontend state is updated correctly.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING