sytone / obsidian-queryallthethings

Query all your data stored in Obsidian, this plugin allows SQL based queries against the data collections available in Obsidian and Dataview. Output can then be rendered by Handlebars
https://sytone.github.io/obsidian-queryallthethings/
MIT License
118 stars 2 forks source link

qatt queries stuck in loading view #22

Open gentzeng opened 2 months ago

gentzeng commented 2 months ago

Describe the bug Every qatt query is stuck in a loop and does not render.

To Reproduce Steps to reproduce the behavior:

  1. Go to any markdown file containing a qatt block
  2. Scroll down to the qatt block
  3. See error

Expected behavior qatt block renders correctly.

Screenshots Above the rending loop, below the same block in edit mode: Bildschirmfoto vom 2024-08-28 21-47-50 +0200 Console says this: Bildschirmfoto vom 2024-08-28 21-47-06 +0200

Desktop (please complete the following information):

Smartphone (please complete the following information):

sytone commented 2 months ago

ok, I need to do a release, I have resolved some loading issues locally except the weird on when a page is pinned.

sytone commented 2 months ago

Can you please update the plugin (1.1.0 or 1.1.1 if you read this later) and restart Obsidian and see if it is still occurring now.

gentzeng commented 1 month ago

It works now in the editing view (normal one, not source view), but in reading view, it just displayes the qatt block like a normal ```....``` block.

Edit: Well, removing qatt from \``qatt` and then readding it fixed the reading view. But there must be a different way to get it to work, right?

Edit 2: Now the same Problem appears, only that the edit view also does only show the block, not the table it is supposed to render. The console show:

plugin:qatt:128 Uncaught DOMException: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.
    at y.onsuccess (plugin:qatt:128:8958)

Trying to force qatt to force to reload cache throws this error in the console:

plugin:qatt:278 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'cacheAllNotes')
    at eval (plugin:qatt:278:4427)
    at e.tryTrigger (app.js:1:723190)
    at e.trigger (app.js:1:723123)
    at t.trigger (app.js:1:2283688)
    at Object.callback (plugin:qatt:193:664)
    at BK (app.js:1:2040559)
    at t.onChooseItem (app.js:1:2630500)
    at t.onChooseSuggestion (app.js:1:1585009)
    at t.selectSuggestion (app.js:1:1584559)
    at e.useSelectedItem (app.js:1:1582418)
    at Object.func (app.js:1:1579817)
    at e.handleKey (app.js:1:754582)
    at e.onKeyEvent (app.js:1:755838)
sytone commented 1 month ago

ok, I had some issue trying to use the long term cache and It should all be disabled in these recent builds.

I have seen a render issue when a page is pinned, I am not sure what is causing this. Closing and opening the pinned page resolves it. Is this a pinned page?

gentzeng commented 1 month ago

No, this is not a pinned note.

But what helps is rebuilding the vault cache from the settings. then, each time i start obsidian, it rebuilds the cache for qatt. However, this only last very short. Some Minutes later, it doesn't work again.

Note that this happens on all of my devices

sytone commented 1 month ago

ok, I just created a new vault to try and reproduce. The QATT cache will rebuild on every start, long story but I have not found a better way to cache as yet and the attempts I made ended up being problematic. For my workflow having a 15s wait on a large vault does not impact me, on the phone it is a second or two.

Do you get the same issue using the obsidian_notes table? I want to eliminate out the dataview integration as I do not use dataview anymore personally.

If you press Ctrl+Shift+I in obsidian on your desktop then go to the Application tab (may need to scroll tops tabs to see it) then select IndexedDB how many databases do you see? There should be some for obsidian and then one for qatt.

Also in settings for QATT is Enable direct creation of tables in AlaSQL enabled?

gentzeng commented 1 month ago

I am only using the obsidian_notes table. But the same happens with the obsidian_markdown_notes table.

The application tab/IndexedDB shows indeed one qatt table and lots of other tables.

Yes, the option Enable direct creation of tables in AlaSQL is enabled.

Your workaround with the cache rebuild also works for me. The delay does not bother me. Here, I'm just not sure if this really happens on each start. On my phone I had to manually rebuild the vault cache. Couple of restarts then and the qatt files where indeed indexed on each restart so that it works so far

gentzeng commented 1 month ago

I think i got it! I'm am using the Homepage plugin. As a homepage I use a note that contains some qatt blocks. I set the homepage plugin such that the homepage note is opened in reading mode. Thats the problem. It only works sometimes when the homepage note is opened in reading view.

Opening it in default mode, which should be editing mode, and it does index it correctly.

The following video illustrates the aforementioned behavior. You can see that in one try, it worked with reading mode. Another try lead to this loading spinner.

https://github.com/user-attachments/assets/979a408d-191d-4d1c-b37c-90872d1e614d

sytone commented 1 month ago

Thanks for the details. This looks similar to to pinned page issue I sometimes see. It is like obsidian does not register the code block handler correctly and the page is rendered before the handler is registered or run.

Have not worked that one out yet.