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

Since installing Obsidian 1.6.0, the File nav tree (left) takes very long time (~20s) to appear on launch #120

Open
luckman212 opened this issue May 11, 2024 · 12 comments

Comments

@luckman212
Copy link
Contributor

I am not sure why, but with Attachment Management enabled, the file explorer tree on the left appears completely blank for a long time after launch of Obsidian.

I tested this on 2 separate computers, both Obsidian 1.6.0, and with NO other extensions enabled.

This is what the UI looks like during that time

image

After some time, the file list appears. There is nothing additional shown in the Console (debug log).

@itoldusoandso
Copy link

In the meantime you can try Attachment MANAGER plugin in the meantime which can move attachments and you can use Attachment Name Formatting plugin to rename attachments (except if you are saving attachments into a subfolder in the attachments folder, then renaming attachments doesn't work).

@luckman212
Copy link
Contributor Author

@itoldusoandso Thank you but I did try that and it doesn't work for my vault which is already heavily organized with attachment subfolders.

@luckman212
Copy link
Contributor Author

luckman212 commented May 17, 2024

I started debugging on my own because I don't know if @trganda is around much

I bisected the initializing functions in main.ts until I found the one causing the huge delay. I then added a simple console log here

this.app.workspace.onLayoutReady(async () => {

>>> console.log("in onLayoutReady!");

I see there's some crazy recursion going on, the func is called 6744 times when Obsidian starts! It feels like an Obsidian bug, since the plugin code hasn't changed, but I don't know if we can work around it somehow, or why onLayoutReady() is being called so often.

screenshot_8NkdMLpY

@luckman212
Copy link
Contributor Author

Here's a perf graph captured during a long load

image

Zooming in at/near the moment when the file tree appears

image

all this is just 1000s of iterations to onLayoutReady()

image

image

@luckman212
Copy link
Contributor Author

I forked the repo and created a fix for this bug. I don't know if it's correct, but please check out luckman212@205362a?diff=unified&w=1

So far it's working for me!

If anyone else wants to test:

  1. clone the https://github.com/luckman212/obsidian-attachment-management repo
  2. run npm i followed by npm run build
  3. Copy main.js, manifest.json and styles.css to your Obsidian plugins folder/obsidian-attachment-management (replacing the originals)

@trganda
Copy link
Owner

trganda commented May 20, 2024

Tks for @luckman212 working. I have no right to using Obsidian v1.6.0 at this time, since I'm not the VIP user (accessing early verison) of Obsidian.

I will checking your fix, and if everything ok I will add it to this repo.

@luckman212
Copy link
Contributor Author

luckman212 commented May 20, 2024

Ah ok @trganda thank you. Hopefully they make 1.6 public soon.

I've been using the patched version for a couple of days now and it's working fine for me. I submitted my change as a pull request: #123.

luckman212 added a commit to luckman212/obsidian-attachment-management that referenced this issue May 20, 2024
luckman212 added a commit to luckman212/obsidian-attachment-management that referenced this issue May 20, 2024
trganda added a commit that referenced this issue May 22, 2024
@trganda
Copy link
Owner

trganda commented May 22, 2024

I have merged PR and released a new version.

@luckman212
Copy link
Contributor Author

@trganda One small thing, I realize I left a debug message in that commit, you may want to remove it. It's here:

console.log(`${this.manifest.name} got onLayoutReady`);

@luckman212
Copy link
Contributor Author

@trganda Just a quick note that 1.6.2 is now publicly available to all.

@trganda
Copy link
Owner

trganda commented Jun 11, 2024

Tks for your tips, I will update and try to adapt the new version.

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