pashashocky / obsidian-note-gallery

A masonry note gallery for obsidian.
GNU General Public License v3.0
192 stars 6 forks source link

[BUG] Gallery doesn't render when "Source" mode is "Default Editing Mode" in Settings. #23

Closed FootPrintStudio closed 8 months ago

FootPrintStudio commented 9 months ago

I acknowledge that I may be using it wrong; however, it appears that the query function doesn't work.

I have tried all of these with no results showing.

~~~~note-gallery
query: 'path: Worlds/The Vault/Masks'
debugQuery: true
~~~~
~~~~note-gallery
query: path:Worlds/The Vault/Masks
debugQuery: true
~~~~
~~~~note-gallery
query: tag:#Masks
debugQuery: true
~~~~
~~~~note-gallery
query: 'tag: #Masks'
debugQuery: true
~~~~

The path function works perfectly; but, I would like only to show results with a specified tag.

I would also like to mention that I'm a big fan of this plugin, there is another one called Page Gallery by Nathan Clark, which is very similar, and honestly a bit more versatile and easier to use; however, due to the amount of results I would like to load its performance is terrible. Perhaps in consideration of that, a "results per page" would be a wise addition, so not every result is loaded at the same time, even though your plugin seems to be more performant so far.

pashashocky commented 9 months ago

Addressing the latter first, we don't actually load all results at once, there's a pagination scheme, but it's pretty deep, so you won't usually notice it.

Now, if you take your query and put it into native obsidian search, do you get results? See my response here: https://github.com/pashashocky/obsidian-note-gallery/issues/22#issuecomment-1928510601

If you see the results from obsidian search, try disabling all other plugins, it's possible there's some interference with another plugin..?

Try opening the developer console CMD+ALT+i on mac, to see if there are any errors happening there.

FootPrintStudio commented 9 months ago

As advised, I checked and the query works within the native search and gives the results I expect, and I disabled all other plugins (reloaded Obsidian after); unfortunately, it still doesn't appear to be working.

Used this.

~~~~note-gallery
query: tag:#Mask
debugQuery: true
~~~~

As for the mentioning of the Page Gallery plugin, just to clarify, that wasn't meant to be disparaging, rather, something you might want to look into for inspiration with further development, also good to know that you've already taken into consideration performance with larger result calls. the Page Gallery plugin would have noticeable lag for me with anything more than 20 results, and it starts to get unusable after 50.

pashashocky commented 9 months ago

For sure, I wasn't aware of the Page Gallery plugin, I'll take a look when I get some time! That is heavily based on dataview and I was planning to build in dataview here as well at some point... so very useful.

I tested on 1000's notes plus and it worked fine in my testing.

Now, with regards to your issue... Are you able to get any results with query? For example:

query: 'testing'
debugQuery: true

SCR-20240206-seuw

If your query matches no documents you should at least have a "no matches found" showing with debugQuery: true. SCR-20240206-sfcz

If the above debug box is not there, and you're not getting any results with query at all - it's likely an issue with hooking into the native search query of Obsidian. I've seen this issue before and I was unable to replicate it so tried to make changes with just partial user feedback and last I've heard about this issue was in #8. Unfortunately Obsidian don't expose a portion of their API and we have to hack around to be able to even have this functionality - it's pretty complicated at this stage.

If you've read to here, please try with a blank/demo vault and confirm that you can replicate - it could be platform specific (what are you on? windows?). If all else fails, come find me in obsidian discord here

FootPrintStudio commented 9 months ago

Yes, I'm on windows.

It looks like it works on a new vault as intended.

image

It appears it is that old issue, since there's nothing showing on the main Vault.

image

HOLD UP! Something worth noting, I was fiddling around and when I switched editing mode from "Source" to "Live Preview" it started working, and still works when switching it back... so there's something there...

FootPrintStudio commented 9 months ago

"Double-checked, and whatever happens when switching the editing mode between "Source" and "Live Preview" modes seems to fix the issue, but only until I restart Obsidian. Hopefully that gives at least some direction as to where to start looking.

And, another oddity, this only works when changing the "Default editing mode" in the options, not when switching between the two modes within a note... Also debugQuery needs to be true...

There could be a strange conflict between the debug function and the editor, but I have no idea.

Actually there appears to be no consistency with debugQuery being true or false.

pashashocky commented 9 months ago

Right, thank god it's not #8. This sounds a lot like #9 - I haven't had a chance to look into that one yet in a lot of detail, I know it's happening, so I might have to make a note about it in the readme. I think I had a quick look and the tip to solving it might be in dataview as I believe it works in source mode.

OK, but this is a weird issue, as on my machine I also can't figure out how to replicate it. I tried switching to "source" mode in both the note and in settings as default mode. Restarted obsidian etc.

What would be really helpful if you can try to record a video or document steps of how I could try to replicate in a blank vault... Is it just related to source mode or I wonder if there's something else...

pashashocky commented 9 months ago

Think I figured it out, it's the first render after a reload that doesn't work when default mode is "Source" mode... that's a mouthful.

video 1 video 2 - mostly for me to remember

Good enough example too.

https://github.com/pashashocky/obsidian-note-gallery/assets/673857/485e62ab-f7d6-46dc-af30-6ddd3c45e68d

FootPrintStudio commented 9 months ago
  1. Created a new blank vault and installed and enabled the plugin.
  2. Added some notes and folders for testing, and it appears to work as intended, even after restarting or a force reload.
  3. Switch the default editing mode to "source mode," restart or force reload and it stops working.

It seems the consistent way for me to get the issue is to start Obsidian with the default editing mode set to "source mode."

pashashocky commented 8 months ago

Fixed in 0.0.59 thank you for your help debugging this! Was a pretty trivial fix tbh. Re-open if any issues!