obsidian-query-language
obsidian-query-language copied to clipboard
TypeErrors using simple query
Hi, I'm getting a TypeError on every edit of a file, and the index won't build. It's a small test vault, and I don't have any plugins installed.
The error:
VM105424:1915 TypeError: Cannot read property 'remove' of undefined
at FuseSearchIndex.removeFile (eval at evalFunc (app.js:1), <anonymous>:1910:37)
at ObsidianQueryLanguagePlugin.eval (eval at evalFunc (app.js:1), <anonymous>:27226:37)
at step (eval at evalFunc (app.js:1), <anonymous>:79:23)
at Object.eval [as next] (eval at evalFunc (app.js:1), <anonymous>:60:53)
at fulfilled (eval at evalFunc (app.js:1), <anonymous>:50:58)
VM105424:1919 Uncaught (in promise) TypeError: Cannot read property 'add' of undefined
at FuseSearchIndex.addFile (eval at evalFunc (app.js:1), <anonymous>:1919:33)
at ObsidianQueryLanguagePlugin.eval (eval at evalFunc (app.js:1), <anonymous>:27227:37)
at step (eval at evalFunc (app.js:1), <anonymous>:79:23)
at Object.eval [as next] (eval at evalFunc (app.js:1), <anonymous>:60:53)
at fulfilled (eval at evalFunc (app.js:1), <anonymous>:50:58
Does this problem persist if you restart/reload the entire vault?
Yes, I've force-reload the vault several times
hi @jplattel I'm facing the same error, doing some troubleshooting I could realize two things
- this problem happens because the Fuse Index is null, so this is only a side effect when a problem happened during the build of the index
- In my case, the problem with building the index, was happening here
I figure out that I had a note with tags: []
on the front matter, that was causing the trouble
A possible would fix would be (but I have no idea if it makes sense hahaha)
if (metadata?.tags && tags !== null) {
tags = tags.concat(metadata.tags.map(tag => tag.tag))
}
In my case changing the front matter, worked 💯
Hey @fernandes... Woah, thanks for the deepdive! I'm able to replicate this now indeed! I'll have a look at the fix you suggested for the next release!
awesome! glad I could help! thanks for the amazing work! 🙇