Skip to content

Commit 9e896a6

Browse files
committed
Current state reflected in the initial-auto-sort-and-notifications.md
1 parent ff46a6e commit 9e896a6

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

docs/tech/initial-auto-sort-and-notifications.md

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@
77
and attempting to do so ends up with an error
88
- there are more challenges when attempting to apply the custom sorting automatically on start
99

10-
An idea of solution, not ideal, but acceptable at glance:
11-
- simplify the logic of notifications - only show when successful
12-
- introduce a new popup "Custom sorting was not applied automatically, apply now?"
13-
- only when it was enabled, only when the File Explorer view is visible
14-
- allow to disable this popup in settings (or via a checkbox "don't show it again")
15-
- introduce a new popup "File Explorer view is not visible, cannot apply custom sort"
16-
- only when the user explicitly attempts to apply custom sort
17-
1810
Additional remarks:
1911
- [Brian Ray](https://github.com/bray) mentions a Lazy Plugin loader in #163
2012
- check it out and make sure it works correctly (gracefully, not necessarily auto-apply custom sort)
@@ -44,26 +36,45 @@ The metadataCache-resolved event becomes very problematic and thus useless. At t
4436
implementation of the plugin relies on it heavily
4537

4638
Scenarios under consideration:
39+
4740
(1a) optimistic scenario of auto-sorting on start on the first display of File Explorer.
4841
- theoretically can happen, never observed on 1.7.2
4942
- metadataCache-resolved event is ignored in this scenario
5043
- UX is excellent
44+
5145
(1b) optimistic scenario of auto-sorting on start in response to metadataCache-resolved event
5246
- happens on desktop as the most frequent one
5347
- metadataCache-resolved event is triggering the custom sort almost immediately
5448
- UX also good, File Explorer appears with custom sorting, even if technically the std sorting was applied
5549
- on mobile the long-taking 'Obsidian is indexing your vault' can prevent the custom sort from being applied quickly
56-
(2) the delayed scenario, e.g. Lazy Plugin Loader or for whatever reason
50+
51+
(2a) the delayed scenario via Lazy Plugin Loader
5752
- happens with Lazy Plugin Loader, by definition
58-
- can happen in regular cases when there a many plugins, slow machine or a large vault
5953
- metadataCache-resolved event is never raised for the plugin until an explicit edit made by user
60-
- File Explorer appears in std order, then is reloaded with custom order
54+
- Lazy Plugin Loader literally invokes the 'plugin enable' Obsidian logic to start the plugin
55+
- File Explorer appears in std order
56+
57+
(2b) the delayed scenario for whatever reason except Lazy Plugin Loader
58+
- can happen in regular cases when there a many plugins, slow machine or a large vault
59+
or on mobile when Obsidian performs the long-taking (re)indexing of vault
60+
- metadataCache-resolved event is normally raised for the plugin as part of startup sequence
61+
- File Explorer appears in std order, then is reloaded with custom order
62+
63+
(3) File Explorer view is not visible on start (a lazy view in 1.7.2)
64+
- nothing can be done to handle this correctly
65+
- maybe there is a way to hook up to the event "File Explorer lazy view is turning into a visible regular view"
6166

6267
Conclusions based on the above scenarios:
63-
- the metadataCache-resolved event can be useful for (1b) both for quick and very delayed metadata cache population (e.g. on mobile)
68+
- the metadataCache-resolved event can be useful for both for quick and very delayed metadata cache population (e.g. on mobile)
6469
- detection of the scenario can be tricky: only first execution, not trigger heavy processing when unprepared
6570
- relating to onLayoutReady could be helpful (do nothing before that)
66-
- for (2) introduce a delayed checker of was-sorting-applied, e.g. every second, repeated N times (e.g. N=3) to support large vaults on slower devices
71+
- for Lazy Plugin Loader introduce a delayed checker of was-sorting-applied, e.g. every second, repeated N times (e.g. N=3)
72+
to support large vaults on slower devices
73+
- rewrite the involved code for clarity, for now there is a lot of legacy duplicated pieces of logic
74+
which makes it hard to determine what is executed when
75+
- focus on supporting 1.7.2, test the recent public 1.6.7 (?)
76+
- ignore backward compatibility with <1.6.7 (don't break it intentionally, just don't test)
77+
- for (3) as already stated directly under (3)
6778

6879
---
6980
Log

0 commit comments

Comments
 (0)