-
-
Notifications
You must be signed in to change notification settings - Fork 94
Description
What happened?
According to the documentation, "If the note doesn't exist yet, Lokus will create it when you click the link." However, when clicking a wiki link that points to a non-existent note, Lokus displays an error message instead of creating the note:
ERROR: Failed to load file: No such file or directory (os error 2)
The editor becomes unresponsive and cannot be edited after this error appears.
Expected behavior: Clicking a link to a non-existent note should automatically create an empty note with that name.
Version
0.1.0 (latest)
Operating System
macOS
Steps to reproduce
- Open any note in Lokus
- Type
[[NewNoteThatDoesNotExist]]and press Enter or select to create the wiki link - Click on the created wiki link
- Error message appears: "Failed to load file: No such file or directory (os error 2)"
- The note is not created and the editor shows an error state
Relevant log output
Failed to load file: No such file or directory (os error 2)Additional context
Two issues contribute to this bug:
-
In
src/editor/components/Editor.jsx, when clicking a wiki link to a non-existent file, the click handler doesn't construct a proper absolute file path. It passes an unresolved relative path to the workspace. -
In
src/views/Workspace.jsx, wheninvoke("read_file_content")fails with a "file not found" error, the code only displays an error message. There's no logic to auto-create the file as documented.
The fix should:
- Construct a proper absolute path for non-existent files (in the same folder as the current note)
- Auto-create the .md file when a "No such file" error occurs
Code of Conduct
- I agree to follow this project's Code of Conduct