dify - 💡(How to fix) Fix Reasoning duration resets to 0.0s after switching browser tab/window in Chatflow [1 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#35424Fetched 2026-04-20 12:15:56
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
1
Participants
Timeline (top)
labeled ×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

  1. Open a Chatflow conversation page that uses a reasoning-capable model.
  2. Send a message and wait until the reasoning duration is displayed normally and the response is fully completed.
  3. Switch to another browser tab or another application window.
  4. Switch back to the Chatflow page.
  5. Check the displayed reasoning duration.

✔️ Expected Behavior

The final reasoning duration of a completed message should remain unchanged after switching tabs/windows or after the page regains focus.

It should continue showing the actual completed duration instead of being reset to 0.0s.

❌ Actual Behavior

The reasoning duration, which was previously displayed correctly, is reset to 0.0s.

extent analysis

TL;DR

The issue can likely be fixed by modifying the code to preserve the reasoning duration when the page regains focus.

Guidance

  • Investigate the code responsible for updating the reasoning duration display and ensure it is not being reset when the page regains focus.
  • Check for any event listeners or timers that may be triggering a reset of the reasoning duration when the page is refocused.
  • Verify that the reasoning duration is being stored in a persistent state, such as a variable or data store, that is not affected by page focus changes.
  • Consider adding a check to ensure the reasoning duration is only updated when a new message is sent, rather than when the page regains focus.

Example

// Pseudo-code example, actual implementation may vary
let reasoningDuration = 0;

// Update reasoning duration when message is sent
function updateReasoningDuration(newDuration) {
  reasoningDuration = newDuration;
  displayReasoningDuration(reasoningDuration);
}

// Display reasoning duration
function displayReasoningDuration(duration) {
  // Code to display the reasoning duration
}

// When page regains focus, do not reset reasoning duration
window.addEventListener('focus', () => {
  // Do not update reasoning duration here
});

Notes

The exact solution will depend on the specific implementation of the Chatflow conversation page and the reasoning-capable model. The provided example is a simplified illustration of the concept.

Recommendation

Apply workaround: Modify the code to preserve the reasoning duration when the page regains focus, as this is likely the cause of the issue.

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