Mocca101/obsidian-plugin-groups

[FR]: Reorder the plugins in one group which are loaded on startup

Closed this issue · 10 comments

Feature Request

It will be perfect that the plugins in one group could be loaded in the order user defines.

Why it's important?

As you know different plugins have different startup speed. The order of the plugins may impact user experience. Some plugins may render the graphical interface slowly in inappropriate order.

To tell the truth, I've applied fast-startup template before which you can see here. Different order does impact user experience. By the way it's not neccessay to create too many groups for this.

Is it feasible?

There's no need to sort the plugin list in the group. I think it is already OK to enable plugins asynchronously in the order user defines. The fast-startup template could be reference. However UI may be complicated as there are moveup and movedown actions.

My Hope

I hope this feature will be added. It's not urgent. I love the plugin. Thank you for your excellent work. ❤️

Thank you for the FR & kind words, it means a lot!

Could you elaborate a bit further on what you mean by not needing to sort the plugins in the group, but allowing them to load asynchronously in the order the user defined?
Would that mean having a global order for plugins & not per group?

Currently the plugins inside a group are loaded synchronously to speed up the loading, while groups inside other groups are loaded synchronously.

I'm thinking maybe it would be a good idea to have an option to set plugins to depend on other plugins being loaded, but that would probably a larger problem to tackle.

I'm open for different ideas and input though!

I'm glad to have your reply. 😃

Maybe my opinion is not totally correct as I'm not familiar with Javascript. Here's part of my fast-startup template.

fastStart = async (filename, delayInSecond) => {
if (tp.file.exists(filename)) {
const f = tp.file.find_tfile(filename);
let plugins = (await app.vault.read(f)).split(/\r?\n/);
setTimeout(async () => {
plugins.forEach(async (p) => await app.plugins.enablePlugin(p))
}, delayInSecond * 1000)
}
}

The template reads the plugin list in specific file and enables plugins with delayed loading. You can see async and await key words. That's what I called asynchronous loading. The order of plugins loaded is defined by users in the file and different order does impact user interface that means in inappropiate order you may see clear loading process. Maybe it's related to Obsidian API app.plugins.enablePlugin.

Sorting plugins in a group is my guess as I see the plugins are not the order I added them. The template upper works well. The order is available in single group.

I'm not clear that if this is better than your synchronous loading. Maybe I'm wrong. From my opinion, loading too many plugins at the same time may slow down the app and impact user interface slightly. Maybe the number of plugins loaded should be limited.

It's just my suggestion about lazy loading. Do what you think is better. 👍

I see what you mean. I will need to take a closer look at it, but you're right, maybe it would be better to limit the amount of plugins that are loaded synchonously, or make it asynchronous all together.

Regarding the sorting: They're currently sorted like that to make the view possible, but I'm in the progress of Reworking the UI (and structure) of the plugin so I'll try to find a good solution for that in the process!

Sidenote: What do you mean with "template upper"?

Regarding the sorting: I think it's just the order user added them and users could reorder them. UI in Commander plugin is fine. Users also need to reorder the buttons. Maybe you can read relevant code for reference.
image

PS: template upper is the fast-startup template pasted upper.

Perfect, thank you!

Hey, I'm back with some hopefully good news:
I think I'm close to fixing it, do you maybe example of plugins where the loading order matters & which caused issues for you so that I can test wether or not it is fixed?

Hello, sincere thanks for your effort. 👍 I've used more than 60 plugins and enabled 30+ on startup.

For example

I enable Customizable-page-header-buttons with 1 second delay and Quick explorer with 2 seconds delay.

This is what I got by Templater startup script.
image

This is what I got by Plugin groups.
image

My thought

Maybe the case is not typical. But the case of different loading orders of plugins in one group which impacts user experience is not easy to reappear for you as it would be impacted by computer performance. I don't want to waste your time. Thus I provide one obvious case above.

What I want is the order of icons, which represent different plugins and appear on status bar, titlebar or sidebar, could be the order I hope. This may be difficult and you needn't to test a lot. I look forward to your new release. 😄

Perfect, thanks!
I'm afraid I won't be able to do that at least for now and if they are in separate groups. I think it might work if they are in the same group and you set the order there, I couldn't reproduce it unfortunately, so please test it once I publish the next (BRAT) release and let me know!

OK, thanks again. I will test it and report the issue if there is. ❤️

Perfect! I love it. ❤️ Thanks a lot for your effort!