ollama - ✅(Solved) Fix app/ui: images in chat messages not displayed on first render in browser [1 pull requests, 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
ollama/ollama#15563Fetched 2026-04-15 06:20:08
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
cross-referenced ×1referenced ×1

Fix Action

Fixed

PR fix notes

PR #15564: app/ui: use data URLs for image thumbnails to fix first-render loading

Description (problem / solution / changelog)

When opening a chat with user-uploaded images, the thumbnails don't render on first load. They appear only after sending a new message and receiving a response.

The ImageThumbnail component used blob URLs (URL.createObjectURL) with a useMemo keyed on the entire image object. When React Query re-fetches chat data, it recreates the attachment objects with new references — even though the content is identical. This causes useMemo to recalculate and create a new blob URL, while the cleanup effect revokes the previous one before the <img> has finished loading it.

Replaced blob URLs with base64 data URLs. Data URLs are immutable strings that don't need lifecycle management — no useEffect cleanup, no revocation, no race condition. The useMemo is now keyed on image.filename and image.data.length (primitives), so it only recalculates when the attachment changes. The tradeoff is ~33% higher memory usage vs blob URLs due to base64 encoding, but chat thumbnails are small (16x16 rem) so the impact is negligible.

Changes:

  • app/ui/app/src/components/ImageThumbnail.tsx: blob URL → data URL, removed useEffect cleanup, stabilized useMemo dependencies

Fixes #15563

Changed files

  • app/ui/app/src/components/ImageThumbnail.tsx (modified, +31/-63)
RAW_BUFFERClick to expand / collapse

What is the issue?

When opening a chat that contains user-uploaded images, the image thumbnails do not render on the first load. They appear only after sending a new message and receiving a response. This happens in the browser (Vite dev server) but not in the desktop app.

Steps to reproduce

  1. Open a chat that has user-uploaded images in previous messages
  2. The images are missing — blank space where thumbnails should be
  3. Send a new message in the same chat
  4. After the response arrives, the images from previous messages appear
<img width="854" height="350" alt="Image" src="https://github.com/user-attachments/assets/365413ca-063a-4f3b-b8f7-c9e74ead5df7" />

Environment

  • Ollama version: 0.20.6
  • OS: macOS

extent analysis

TL;DR

The issue can likely be resolved by re-examining the image loading logic to ensure thumbnails are properly rendered on initial chat load.

Guidance

  • Verify that the image thumbnail URLs are correctly generated and accessible when the chat is first loaded.
  • Check the JavaScript code responsible for rendering the image thumbnails to ensure it is not dependent on a subsequent message being sent or received.
  • Investigate potential caching or lazy loading mechanisms that might be interfering with the initial rendering of image thumbnails.
  • Compare the rendering logic between the browser (Vite dev server) and desktop app to identify any discrepancies.

Example

No code snippet can be provided without more context, but reviewing the image rendering function or component might look something like checking for an onLoad event or ensuring that the thumbnail URLs are correctly appended to the chat message HTML.

Notes

The issue seems to be specific to the browser environment (Vite dev server) and does not occur in the desktop app, suggesting a potential difference in how resources are loaded or rendered between these two environments.

Recommendation

Apply a workaround by re-examining and potentially modifying the image thumbnail rendering logic to ensure it works correctly on initial chat load in the browser environment, as the root cause seems related to how images are loaded or rendered in this specific context.

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