Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeErrors using simple query #15

Open
HEmile opened this issue Mar 11, 2021 · 5 comments
Open

TypeErrors using simple query #15

HEmile opened this issue Mar 11, 2021 · 5 comments

Comments

@HEmile
Copy link

HEmile commented Mar 11, 2021

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
@jplattel
Copy link
Owner

Does this problem persist if you restart/reload the entire vault?

@HEmile
Copy link
Author

HEmile commented Mar 11, 2021

Yes, I've force-reload the vault several times

@fernandes
Copy link

hi @jplattel I'm facing the same error, doing some troubleshooting I could realize two things

  1. 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
  2. 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 💯

@jplattel
Copy link
Owner

jplattel commented Jun 3, 2021

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!

@fernandes
Copy link

awesome! glad I could help! thanks for the amazing work! 🙇

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

No branches or pull requests

3 participants