Skip to content

fix: Internal image cache isn't reset if failed to load (#3001)#3010

Merged
Jocs merged 3 commits into
marktext:developfrom
kiyoka:fix-issue-3001
May 18, 2026
Merged

fix: Internal image cache isn't reset if failed to load (#3001)#3010
Jocs merged 3 commits into
marktext:developfrom
kiyoka:fix-issue-3001

Conversation

@kiyoka
Copy link
Copy Markdown
Contributor

@kiyoka kiyoka commented Feb 13, 2022

In the loadImageAsync function, images that failed last time will try to be reloaded.

Q A
Bug fix? yes
New feature? no
Breaking changes? no
Deprecations? no
New tests added? not needed
Fixed tickets Fixes #3001
License MIT

In the loadImageAsync function, images that failed last time will try to be reloaded.
@kiyoka kiyoka changed the title fix: #3001 Internal image cache isn't reset if failed to load fix: Internal image cache isn't reset if failed to load (#3001) Feb 13, 2022
@fxha
Copy link
Copy Markdown
Contributor

fxha commented Feb 16, 2022

Hey thanks for the fix, but unfortunately I noticed that this will lead to flickering if you type text or change cursor position because the loading animation is applied to the image for a very short time before falling back to the failed state.

@kiyoka
Copy link
Copy Markdown
Contributor Author

kiyoka commented Feb 17, 2022

Oops, I'll think of another approach.
This issue is closed.

@kiyoka kiyoka closed this Feb 17, 2022
@kiyoka kiyoka reopened this Feb 19, 2022
@kiyoka
Copy link
Copy Markdown
Contributor Author

kiyoka commented Feb 19, 2022

I followed the cause of the flickering.
The reason is that the CSS ag-image-fail and ag-image-loading have different heights, so they flicker when the image is reloaded.
Why don't we prepare ag-image-reloading and design it at the same height as ag-image-fail?
Images that failed to load last time will start from the ag-image-reloading state.

I added automatic image reloading, and now it flickers when I edit a markdown document.
Fixed it by setting the height of ag-image-fail and ag-image-loading to be the same as the height of ag-image-fail. (50px)
@fxha
Copy link
Copy Markdown
Contributor

fxha commented Mar 19, 2022

Why don't we prepare ag-image-reloading and design it at the same height as ag-image-fail?

It seems to be a reasonable idea to me 👍

Another option would be to provide a manually reload button? @Jocs @kiyoka

@kiyoka
Copy link
Copy Markdown
Contributor Author

kiyoka commented Apr 1, 2022

Another option would be to provide a manually reload button? @Jocs @kiyoka

In most cases, I believe there are a few images that fail to load.
User should fix the link soon, so automatic reloading is fine.

@fxha fxha requested a review from Jocs April 14, 2022 20:28
@Jocs
Copy link
Copy Markdown
Member

Jocs commented May 15, 2026

This project recently merged a large refactor (electron-vite migration, PR #4001) that upgraded dependencies and fixed several issues.

Please review this PR and let us know if it is still needed, or if the changes have already been addressed upstream.

@Jocs Jocs merged commit bca2ed6 into marktext:develop May 18, 2026
1 check passed
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.

Internal image cache isn't reset if failed to load

3 participants