ollama - ✅(Solved) Fix app/ui: thinking section re-creates ResizeObserver on every token and renders markdown when hidden [1 pull requests, 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
ollama/ollama#16003Fetched 2026-05-07 03:31:52
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Participants
Timeline (top)
commented ×1cross-referenced ×1labeled ×1

Fix Action

Fixed

PR fix notes

PR #16006: app/ui: fix ResizeObserver recreation and skip hidden markdown rendering

Description (problem / solution / changelog)

  1. The ResizeObserver in Thinking.tsx was being torn down and re-created on every single streamed token because of the [thinking] dependency. Changed it to empty deps so the observer persists.
  2. The StreamingMarkdownContent inside the thinking section was rendering full markdown even when the section was completely collapsed and finished (invisible to the user), wasting CPU. Added a conditional check to skip rendering in this state.

Fixes #16003

Changed files

  • app/ui/app/src/components/Thinking.tsx (modified, +17/-15)
RAW_BUFFERClick to expand / collapse

What is the issue?

Two problems in the thinking/reasoning panel:

  1. While the model is actively thinking, the ResizeObserver that measures content height is torn down and re-created on every single streamed token. This is unnecessary overhead — a ResizeObserver automatically detects size changes once attached.

  2. When thinking is finished and the section is collapsed, the full Streamdown + Shiki markdown rendering still runs behind the scenes even though the content is completely hidden (opacity 0, height 0). This wastes CPU cycles on invisible content.

Expected behavior The ResizeObserver should be set up once when the element mounts and left running. The markdown rendering should be skipped entirely when the thinking section is collapsed and finished.

Relevant log output

OS

macOS

GPU

Apple

CPU

Apple

Ollama version

No response

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

ollama - ✅(Solved) Fix app/ui: thinking section re-creates ResizeObserver on every token and renders markdown when hidden [1 pull requests, 1 comments, 2 participants]