- Links between notes don't work - Support - Joplin Forum (joplinapp.org)
- Resource ID not provided error when click link with markdown pane closed · Issue #4891 · laurent22/joplin (github.com)
while working on the issue( stated above ), I found the following reasons behind it :
The issue is solely with the joplin/contextMenu.ts at dev · laurent22/joplin (github.com) file. The whole file is written assuming that the selected link is a
Resourcelink and not a
Note. When right-clicking on the link( only the note-links ) and select open, the
onActionfunction directly calls the
ResourceEditWatcher.instance().openAndWatch(options.resourceId);. Now, in the
packages/lib/services/ResourceEditWatcher/index.ts( joplin/index.ts at ebf92605aeabbd686d57952ab6b946d2db8dcf27 · laurent22/joplin · GitHub ), it calls
Resource.load(resourceId)although it is not a resource id, and what happens is that the SQL command in
packages/lib/BaseModel.ts( joplin/BaseModel.ts at ebf92605aeabbd686d57952ab6b946d2db8dcf27 · laurent22/joplin · GitHub ) tries to find the given note-id in the
resources( As returned by the
Resource.tableName()) table. Definitely,
sqlite3doesn't find any resource with that id (note-id) in the
resourcestable, so finally, the item returned by
Resource.load(resourceId)is undefined. In the next line,
undefinedgets passed to
Resource.isReady()which ultimately leads to calling
Resourcce.localState()and it throws the
Resource ID not providedError.
On the other hand, if you
ctrl+clickon the link, the control goes to
useMassegeHandler.tswhich efficiently handles it by calling
const item = await BaseItem.loadItemById(itemId);first. Then it checks if it is a resource or a note. That's why the
So, I posted it in the forum because :
- It is given a high-priority label.
- It looks like the whole
contextMenu.tsneeds to be updated which would be a kind of breaking change and can affect many things. Also, it might lead to a change of around 50 lines of code.
Any comments/suggestions/opinions on it (like how to fix it or even if it is worth fixing as it has a workaround using
ctrl+click ) from any dev are highly appreciated.