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

Doesn't work on initial load - Obsidian 1.6.1 #11

Closed
luckman212 opened this issue May 23, 2024 · 13 comments
Closed

Doesn't work on initial load - Obsidian 1.6.1 #11

luckman212 opened this issue May 23, 2024 · 13 comments
Assignees

Comments

@luckman212
Copy link
Contributor

Since 1.6 (1.6.1 now) the plugin doesn't hide folder at first launch. Probably needs a delay or a wrapping inside of onLayoutReady()

@JonasDoesThings
Copy link
Owner

Hope I will find time tomorrow after work. Thanks for the hint with delay/onLayoutReady, should hopefully be a quick fix then 🙏

@JonasDoesThings
Copy link
Owner

Oh, just saw that 1.6.x is still an insider-build. Since I sadly do not have a paid catalyst license, I cannot work on the issue at this point of time.

I will look into it, as soon as 1.6.x is available for me.

@JonasDoesThings JonasDoesThings self-assigned this May 29, 2024
@luckman212
Copy link
Contributor Author

Hi @JonasDoesThings just a note that 1.6.2 was just made public!

@JonasDoesThings
Copy link
Owner

Hi, thanks for the heads-up @luckman212

I sadly could not reproduce the issue, but I added an additional call to the plugin's processFolders in the onLayoutReady callback. Could you please check if the issue still persists using the latest v1.4.1?

@luckman212
Copy link
Contributor Author

luckman212 commented Jun 7, 2024

I updated to 1.4.1 but the plugin still doesn't hide the folders at initial launch. I have to toggle it off and then back on to make it take effect... anything else I can do to debug? Here's my console...

image

@calmwaves111
Copy link

+1,I had the same problem

luckman212 added a commit to luckman212/obsidian-hide-folders that referenced this issue Jun 12, 2024
@luckman212
Copy link
Contributor Author

I forked and fixed it, very simple patch - @calmwaves111 let me know if that works for you

@JonasDoesThings
Copy link
Owner

Hm, makes sense. My test-vault and my normal vault both don't have these big plugins that take long on startup so that could have been the reason why I couldn't reproduce the issue myself.

I have now merged your PR @luckman212 and released a new version 1.4.2 with the changes.
Please report back if the issue is fixed for you too @calmwaves111 :)

I appreciate the help! Thx ❤️

@luckman212
Copy link
Contributor Author

luckman212 commented Jun 12, 2024

@JonasDoesThings awesome, thanks!

Another thing I noticed (somewhat related to this bug), is that if the File Explorer is NOT visible when Obsidian is launched (e.g. if you had the Search tab selected instead e.g.) then the folders also fail to get hidden.

Looking at the code it seems like that's because the page elements are lazy-loaded and if they aren't visible, then processFolders() won't act on them.

I don't know if there is a hook we can monitor for when the File Explorer first becomes visible but if there is, that would be a better place to hook into than onLayoutReady. I checked the API docs and didn't find one... may have to ask Licat...

@luckman212
Copy link
Contributor Author

luckman212 commented Jun 13, 2024

A possible workaround: ensure that the File Explorer is shown at startup:

app.workspace.ensureSideLeaf('file-explorer', 'left', { active: true });

@luckman212
Copy link
Contributor Author

luckman212 commented Jun 13, 2024

Tested on my fork (works!)

New PR: #15

@luckman212
Copy link
Contributor Author

luckman212 commented Jun 22, 2024

New PR: #16

(works for me)

@JonasDoesThings
Copy link
Owner

With the PR being merged & released, I think we can close this now :)

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