-
-
Notifications
You must be signed in to change notification settings - Fork 162
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
Fix the ordering of categories after application restart #689
Comments
The order of categories shouldn't be random: Recently used categories should show up first, preceded by pinned ones. Pinned categories shouldn't reset after a restart though, are you sure about this? (As in, they don't show up as pinned in the categories configuration screen?) |
After a bit more sleuthing, I believe this problem was caused by search cache warm at application boot, which used to do a search for all categories in order to "prep" them -- Which would update their recently used date. 🙄 Cache warm jobs have been entirely removed, so I suspect this shouldn't happen anymore. Letting open for now just in case tho |
Leaving this at Feb. 2023 and 0.8.81, I can confirm that this issue is still present. The behavior of LR is still the exact same as I've shown previously, but I won't post screenshots here since censoring all my stuff takes too much time. Still, might need to look into this further. |
@soarpasser I was under the impression that categories did not have a sort order and just added from right to left. I was able to have it sort alphabetically from A-Z for pinned categories (in pink outlines), then A-Z for other categories. Both left to right, as shown in my screenshot above. As for the categories listed in the context menu, I know what you mean by the ordering getting shuffled after restart. It doesn't shuffle if I just terminate LANraragi, only when the redis-server stops. I'm trying to change it there as well. @Difegue are the categories just randomly taken on boot as just hashes without any sorting? Sorry, I don't know anything about Perl, but interested in fixing this myself. |
@cazendium Conveniently, the sorting code does not use any Perl at all! 😛 Sorting is done clientside based on pinned + last used time. See the code here: Line 580 in d2ab680
|
@Difegue that’s true! I should’ve meant it’s lacking one in Perl, specifically in the Model > Category.pm 🤓 LANraragi/lib/LANraragi/Model/Category.pm Line 34 in d2ab680
I added a sort before returning Isn’t it more preferable to sort things from A-Z especially when categories get too large? |
@Difegue @soarpasser the following code below sorts my categories above the search bar alphabetically and in the context menu. But I noticed the redis-server process needs to be stopped too to notice the effects change in the context menu. index.js
Model Category.pm
|
My initial thinking behind sorting by last_used time was that if you use a specific category a bunch it'd float up naturally instead of making you hunt in the dropdown -- But if it's buggy/changes too often, we might as well just sort alphabetically and make users rely on pinning. Could you make a PR with those changes? |
There seems to be an error in the category sorting after the update. It does not seem to be sorted according to the alphabetical order mentioned above, and the pinning category seems to be invalid. I don’t know if it has something to do with the use of Chinese. |
Currently LR randomizes the display order of a user's archive categories every time the application restarts, see:
Before restart
After restart
Same goes for the "add to category" dropdown menu whenever you right click an archive, and the dropdown list order in the "modify categories" tab.
This can be a bit of an annoyance in some cases especially for users with OCD (lol).
Pinning the categories one by one in the "modify categories" tab does not work since pinned categories go back to being unpinned after LR restarts as well. Not sure if that is intended behavior.
Either way, it would be neat to at least let the user arrange the ordering of categories and save them.
The text was updated successfully, but these errors were encountered: