Repository navigation
fix(editor): refresh changed local Markdown images - #13764
kevinyang372 merged 2 commits into
Conversation
|
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 |
|
The cla-bot has been summoned, and re-checked this pull request! |
…markdown-image-cache
|
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: Comment Powered by Oz |
There was a problem hiding this comment.
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
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)
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)
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.
ready-to-implement.Testing
./script/runAutomated validation:
./script/format --checkcargo clippy --workspace --exclude warp_completer --all-targets --tests -- -D warningscargo clippy -p warp_completer --all-targets --tests -- -D warningscargo 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 --docScreenshots / Videos
Manual verification on the local OSS bundle:
chart.svgshowing BEFORE.chart.svgon disk at the same path with UPDATED content.Before refresh
After replacing the same path and choosing Refresh file
Agent Mode
CHANGELOG-BUG-FIX: Local images embedded in Markdown now refresh after their files change on disk.