Skip to content

Raise PropertyChanged when ResultViewModel image properties are set - #4624

Open
TrueCrimeDev wants to merge 1 commit into
Flow-Launcher:devfrom
TrueCrimeDev:fix/result-icon-binding-notify
Open

Raise PropertyChanged when ResultViewModel image properties are set#4624
TrueCrimeDev wants to merge 1 commit into
Flow-Launcher:devfrom
TrueCrimeDev:fix/result-icon-binding-notify

Conversation

@TrueCrimeDev

@TrueCrimeDev TrueCrimeDev commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Problem

ResultViewModel.Image, BadgeImage, and PreviewImage never raise PropertyChanged when set. LoadImageAsync awaits the image load and then assigns the property, and its comment states that "modifying the property" triggers the change notification — but the setters are plain field assignments:

private set => _image = value;

Root cause

The notification was lost in e8691c2 (May 2021, "No need for the wrapped Lazy instance in image loading"), which inlined the LazyAsync<ImageSource> wrapper. That wrapper's updateCallback was what called OnPropertyChanged(nameof(Image)); when it was removed, nothing replaced it.

Why it usually doesn't show

A repeat lookup of the same IcoPath hits ImageCache synchronously inside the getter, so the binding already sees the real image the first time it evaluates. The bug only surfaces when a brand-new IcoPath arrives and the host doesn't virtualize the row out and back in — e.g. a single-result query such as a chat plugin's "Ask" preview. There the field is mutated after the await, the binding is never re-evaluated, and the row stays on LoadingImage indefinitely.

Fix

Raise OnPropertyChanged() in all three image setters. ResultViewModel already derives from BaseModel, so no other plumbing is needed.

Testing

  • dotnet build Flow.Launcher.sln -c Release — 0 errors
  • dotnet test -c Release — 433 passed

ImageLoaderTests.ShellThumbnailFailure_Directory_ReturnsDefaultFolderImageAsync fails on the first run against a fresh build output on my machine, but it fails identically on unmodified dev, so it is unrelated to this change.


Summary by cubic

Summary of changes

Ensures ResultViewModel image properties notify bindings after async loads so icons refresh. Previously, Image, BadgeImage, and PreviewImage setters did not raise PropertyChanged, so some results stayed on LoadingImage.

  • Changed: Added OnPropertyChanged() in the setters for Image, BadgeImage, and PreviewImage, restoring behavior lost when the LazyAsync<ImageSource> wrapper was removed.
  • Added: Bindings now re-evaluate when the image finishes loading; no public API changes.
  • Removed: No logic removed.
  • Memory impact: None beyond an extra method call per property set; no new allocations.
  • Security risks: None.
  • Unit tests: No new tests. Existing suite passes locally (433 tests). One known unrelated thumbnail test is flaky on a fresh build in both this branch and dev.

Release Note

Fixes an issue where some result icons stayed stuck on the loading image by updating them automatically once the icon finishes loading.

Written for commit 4ee56ab. Summary will update on new commits.

Review in cubic

The Image, BadgeImage, and PreviewImage setters never raised
PropertyChanged, even though the LoadImageAsync comments asserted that
"modifying the property" was supposed to trigger the event. The notify
call was lost in 2021 when the LazyAsync<ImageSource> wrapper was
inlined (e8691c2).

The bug usually hides because subsequent identical IcoPath lookups hit
ImageCache synchronously in the getter, so the binding sees the loaded
image on its first evaluation. But when a brand-new IcoPath comes in
and the host doesn't virtualize the row out and back in (e.g., a
single-result query like a chat plugin's "Ask" preview), the field is
mutated post-await and the binding stays on LoadingImage forever.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 17, 2026 15:56
@github-actions github-actions Bot added this to the 2.2.0 milestone Aug 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

An error occurred during the review process. Please try again later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants