-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalidate image cache when modified on disk #703
Comments
Do you mean change the name of |
Just modify the existing image. E.g. change the color from red to black. |
Is this issue the same with #656 ? |
I don't think so because we add all images to an "image cache", so we don't have to make continuous http requests but local files may be modified. I think the issue is that we add local files ( |
After listening to (after we'll do) the local image modification, you also need to inform the editor to reload the markdown file. At this same time, we also need to clear the image cache to ensure the image is loaded? |
@fxha Isn't Electron just caching |
@fabiospampinato I don't think so because it's only locally, so it wouldn't make any sense, but Chromium may prevent to reload the image because the URL is the same as before on the same HTML element and we may need to add a semi-random suffix like |
That's what I meant, i.e. the following:
I don't think is correct, you don't need to do anything to get this behavior. |
If I remember correctly, we're using a map/cache that maps paths/URL's to images for better render performance, so we can reuse the old DOM element instead making another HTTP request. But I'm not totally sure and currently don't have any time to invest the issue. @fabiospampinato Do you have a similar issue in Notable? That would mean Chromium does caching. |
That's interesting, does that help performance a lot? 🤔
Yes, and I'm not doing any kind of manual caching. |
I think it is possible to use a periodic timer to check the update time of image files. |
Same issue in #2320 |
I have experimented with this issue and found it to be quite difficult. |
This is PoC code. Since it is difficult to automatically detect updates to image files, the F5 key is used to refresh and redisplay the image.
define keybindings for 'Reload Images'.
Only local files were invalidated.
Reload images in local files with F5 key. (No file update detection)
On macOS, the Command+R key was duplicated, so I changed the key for view.dev-reload to Command+Alt+R.
Applied the review remarks in the pull request.
Description
An image is not correctly reloaded when the image is modified on disk.
Steps to reproduce
![](a.png)
a.png
on diskExpected behavior:
The modified image is displayed.
Actual behavior:
The image is not reloaded because it's fetched from cache.
Versions
The text was updated successfully, but these errors were encountered: