|
7 | 7 | and attempting to do so ends up with an error |
8 | 8 | - there are more challenges when attempting to apply the custom sorting automatically on start |
9 | 9 |
|
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 | | - |
18 | 10 | Additional remarks: |
19 | 11 | - [Brian Ray](https://github.com/bray) mentions a Lazy Plugin loader in #163 |
20 | 12 | - 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 |
44 | 36 | implementation of the plugin relies on it heavily |
45 | 37 |
|
46 | 38 | Scenarios under consideration: |
| 39 | + |
47 | 40 | (1a) optimistic scenario of auto-sorting on start on the first display of File Explorer. |
48 | 41 | - theoretically can happen, never observed on 1.7.2 |
49 | 42 | - metadataCache-resolved event is ignored in this scenario |
50 | 43 | - UX is excellent |
| 44 | + |
51 | 45 | (1b) optimistic scenario of auto-sorting on start in response to metadataCache-resolved event |
52 | 46 | - happens on desktop as the most frequent one |
53 | 47 | - metadataCache-resolved event is triggering the custom sort almost immediately |
54 | 48 | - UX also good, File Explorer appears with custom sorting, even if technically the std sorting was applied |
55 | 49 | - 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 |
57 | 52 | - happens with Lazy Plugin Loader, by definition |
58 | | - - can happen in regular cases when there a many plugins, slow machine or a large vault |
59 | 53 | - 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" |
61 | 66 |
|
62 | 67 | 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) |
64 | 69 | - detection of the scenario can be tricky: only first execution, not trigger heavy processing when unprepared |
65 | 70 | - 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) |
67 | 78 |
|
68 | 79 | --- |
69 | 80 | Log |
|
0 commit comments