-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Description
When a user closes a tab containing images and reopens the same note from the sidebar, all images display "Failed to load image" instead of rendering correctly. The images work fine on initial paste and while the tab stays open.
Root Cause
The image node serializes only imageId to JSON (not src / local file path). On fresh mount from DB, ImageComponent resolves imageId → filePath via images.getPath IPC, then converts it to a lychee-image://image/{filename} URL. The custom protocol handler appears to fail to resolve the file at this point, causing the <img> preload to error and the component to show the error state.
Reproduction
- Create a new note
- Paste an image (any image)
- Wait for it to save
- Close the tab (click the X on the tab)
- Click the note in the sidebar to reopen it
- The image shows "Failed to load image" with the
ImageOfficon
Expected Behavior
The image should load and display correctly after reopening, just as it did before closing the tab.
Context
- Discovered while writing e2e tests for the editor auto-focus fix (Editor doesn't auto-scroll when dragging blocks near viewport edges #75 area)
- The
editor.update()for path resolution still fires correctly — only the subsequent image render via the custom protocol fails exportJSON()inimage-node.tsxintentionally omits__src(only persistsimageId), so path resolution on reopen is the expected flow
Files
src/components/editor/nodes/image-component.tsx— path resolution logic (line ~104)src/components/editor/nodes/image-node.tsx— serialization (exportJSON/importJSON)- Main process custom protocol handler for
lychee-image://
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels