Skip to content

fix(editor): refresh changed local Markdown images - #13764

Merged
kevinyang372 merged 2 commits into
warpdotdev:masterfrom
rasitakyol:rasitakyol/gh13658-markdown-image-cache
Jul 15, 2026
Merged

kevinyang372 merged 2 commits into
warpdotdev:masterfrom
rasitakyol:rasitakyol/gh13658-markdown-image-cache

Conversation

@rasitakyol

@rasitakyol rasitakyol commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes stale local images in the Markdown viewer by adding the image file's metadata-derived content version to its asset source when the Markdown block is laid out. This gives an edited file a new image-cache key while keeping filesystem I/O out of ordinary frame rendering.

The change is limited to the Markdown image resolver. Remote URLs and data URIs retain their existing cache identities, and regression tests cover both the local-file invalidation path and unchanged non-local sources.

Linked Issue

Fixes #13658.

  • The linked issue is labeled ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below.

Testing

  • I have manually tested my changes locally with ./script/run

Automated validation:

  • ./script/format --check
  • cargo clippy --workspace --exclude warp_completer --all-targets --tests -- -D warnings
  • cargo clippy -p warp_completer --all-targets --tests -- -D warnings
  • cargo nextest run -p warp_editor (478 passed)
  • cargo nextest run -p warp_completer --features v2 (117 passed, 4 skipped)
  • cargo nextest run --no-fail-fast --workspace --exclude command-signatures-v2 (9,018 passed, 5 SSH integration tests failed because the local SSH/password-prompt harness was unavailable)
  • cargo test --doc

Screenshots / Videos

Manual verification on the local OSS bundle:

  1. Opened the Markdown file with a same-path local chart.svg showing BEFORE.
  2. Replaced chart.svg on disk at the same path with UPDATED content.
  3. Used the pane menu's Refresh file action; the rendered image updated without changing the Markdown reference.

Before refresh

gh13658-before

After replacing the same path and choosing Refresh file

gh13658-after

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-BUG-FIX: Local images embedded in Markdown now refresh after their files change on disk.

@cla-bot

cla-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @rasitakyol on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment @cla-bot check to trigger another check.

@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label Jul 15, 2026
@rasitakyol

Copy link
Copy Markdown
Contributor Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed label Jul 15, 2026
@cla-bot

cla-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@rasitakyol
rasitakyol marked this pull request as ready for review July 15, 2026 17:14
@warp-for-oss

warp-for-oss Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

@rasitakyol

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I reviewed this pull request and requested human review from: @kevinyang372.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@warp-for-oss warp-for-oss 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.

Overview

This PR updates Markdown image asset resolution so local-file sources include a metadata-derived content version when laid out, allowing refreshed Markdown documents to invalidate stale local image cache entries while leaving remote URLs and data URIs unchanged. It also adds regression coverage for local-file versioning and non-local source stability.

Concerns

  • No blocking concerns found.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@warp-for-oss
warp-for-oss Bot requested a review from kevinyang372 July 15, 2026 17:18
@kevinyang372
kevinyang372 enabled auto-merge (squash) July 15, 2026 19:28
@kevinyang372
kevinyang372 merged commit be54767 into warpdotdev:master Jul 15, 2026
35 checks passed
@rasitakyol
rasitakyol deleted the rasitakyol/gh13658-markdown-image-cache branch July 17, 2026 19:24
TranscriptionFactory pushed a commit to TranscriptionFactory/warp that referenced this pull request Aug 30, 2026
Fixes stale local images in the Markdown viewer by adding the image
file's metadata-derived content version to its asset source when the
Markdown block is laid out. This gives an edited file a new image-cache
key while keeping filesystem I/O out of ordinary frame rendering.

The change is limited to the Markdown image resolver. Remote URLs and
data URIs retain their existing cache identities, and regression tests
cover both the local-file invalidation path and unchanged non-local
sources.

Fixes warpdotdev#13658.

- [x] The linked issue is labeled `ready-to-implement`.
- [x] Where appropriate, screenshots or a short video of the
implementation are included below.

- [x] I have manually tested my changes locally with `./script/run`

Automated validation:

- `./script/format --check`
- `cargo clippy --workspace --exclude warp_completer --all-targets
--tests -- -D warnings`
- `cargo clippy -p warp_completer --all-targets --tests -- -D warnings`
- `cargo nextest run -p warp_editor` (478 passed)
- `cargo nextest run -p warp_completer --features v2` (117 passed, 4
skipped)
- `cargo nextest run --no-fail-fast --workspace --exclude
command-signatures-v2` (9,018 passed, 5 SSH integration tests failed
because the local SSH/password-prompt harness was unavailable)
- `cargo test --doc`

Manual verification on the local OSS bundle:

1. Opened the Markdown file with a same-path local `chart.svg` showing
**BEFORE**.
2. Replaced `chart.svg` on disk at the same path with **UPDATED**
content.
3. Used the pane menu's **Refresh file** action; the rendered image
updated without changing the Markdown reference.

**Before refresh**

<img width="1229" height="768" alt="gh13658-before"
src="https://github.com/user-attachments/assets/7214296e-6289-429a-b5a2-42cc2aa59e1f"
/>

**After replacing the same path and choosing Refresh file**

<img width="1229" height="768" alt="gh13658-after"
src="https://github.com/user-attachments/assets/2cdf9cab-a4eb-471a-86f9-c0ee53ebd822"
/>

- [ ] Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-BUG-FIX: Local images embedded in Markdown now refresh after
their files change on disk.

(cherry picked from commit be54767)
NourEldinShobier pushed a commit to NourEldinShobier/MyWarp that referenced this pull request Nov 16, 2026
Local images embedded in Markdown stayed stale after their files changed on
disk, because AssetSource::LocalFile was keyed by path only. Attach the file's
metadata-derived content version to the asset source when the Markdown block is
laid out, so an edited file gets a new image-cache key while ordinary frame
rendering stays I/O-free. Remote URLs keep their existing cache identities.

Requires the framework surface from warpdotdev#12840 (LocalFileContentVersion,
AssetSource::with_local_file_content_version, and the versioned-local-file eviction
in AssetCache), ported here since Zap does not have that commit yet. The AI-blocklist
caller change of warpdotdev#12840 is not included; it belongs to that upstream task.

(cherry picked from commit be54767)
(cherry picked from commit c85882d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown viewer shows stale embedded local images after file content changes on disk (incl. Refresh file button)

2 participants