Client side sorting/filtering for the Store page
Please tick as appropriate:
- [x] I have tested this code on a steam deck or on a PC
- [x] My changes generate no new errors/warnings
- [x] This is a bugfix/hotfix
- [x] This is a new feature
Description
This fixes issue: #768 NOTE: This fix doesn't change the backend and the original functionality of fetching with sort still has it's issue.
Currently the way that the frontend sorts the plugin lists by going through the backend and making new network requests each time. This means wasted bandwidth and added latency for every time you want to change sorting order. Over time, more plugins will mean a bigger network response.
This PR introduces client side sorting and also filtering. The plugin list is fetched once when the component loads, and subsequent filtering and sorting is done on the client. This means we're only fetching data once on page load.
I also did expose a few missing properties for StorePlugin as part of this change and shouldn't affect functionality of the rest of the app.
I also did make a few adjustments to how the dropdown for sorting is handled with data opting for a singular key instead of the tuple. For filtering, I did opt for a pattern which allows for a more seamless integration of new filter patterns:
- Add new filter to enum.
- Create translation key matching the enum string value in the proper path.
- Add functionality for the filtering in the
filterPluginfunction.
I'm interested in your thoughts on this implementation.
Demo
Any update on merging this? As of today sorting is still reversed, as mentioned on the original issue.
Any update on merging this? As of today sorting is still reversed, as mentioned on the original issue.
They don't want to accept this as a fix to the issue due to the API being the core cause of this problem. I don't know if that code is public or not.
Any update on merging this? As of today sorting is still reversed, as mentioned on the original issue.
They don't want to accept this as a fix to the issue due to the API being the core cause of this problem. I don't know if that code is public or not.
Went around searching and found this, but the problem is that it looks fine? https://github.com/SteamDeckHomebrew/decky-plugin-store/blob/main/plugin_store/database/database.py#L224-L227 https://github.com/SteamDeckHomebrew/decky-plugin-store/blob/main/plugin_store/api/init.py#L145-L155
Any update on merging this? As of today sorting is still reversed, as mentioned on the original issue.
They don't want to accept this as a fix to the issue due to the API being the core cause of this problem. I don't know if that code is public or not.
Went around searching and found this, but the problem is that it looks fine? https://github.com/SteamDeckHomebrew/decky-plugin-store/blob/main/plugin_store/database/database.py#L224-L227 https://github.com/SteamDeckHomebrew/decky-plugin-store/blob/main/plugin_store/api/init.py#L145-L155
Right now they flipped it on the front end. It's possible that things are just working fine now and they could accept this PR albeit with some changes. I'll have to look at it some more when I have some free time.
I like many of the changes here, but sorting on the frontend could present a problem if pagination is ever added to the store. I believe that's why we have API requests when sorting.
I like many of the changes here, but sorting on the frontend could present a problem if pagination is ever added to the store. I believe that's why we have API requests when sorting.
I believe someone else mentioned this before on the Discord. I'm happy to remove sorting logic from the frontend code.
I like many of the changes here, but sorting on the frontend could present a problem if pagination is ever added to the store. I believe that's why we have API requests when sorting.
Is this the right api url currently used? https://plugins.deckbrew.xyz/plugins?sort_by=name&sort_direction=asc
Do you know why asc and desc are returning reversed?
Edit: oh and capitalized letters are showing up first, and lowercase at the end. in this case inverted because every response is inverted
Is this the right api url currently used? https://plugins.deckbrew.xyz/plugins?sort_by=name&sort_direction=asc Do you know why asc and desc are returning reversed? Edit: oh and capitalized letters are showing up first, and lowercase at the end. in this case inverted because every response is inverted
I've not had time to research the issue nor do I contribute to the plugin store repo, but the relevant code is here if you'd like to take a look. I think the endpoint may've had issues sorting when I worked on the new store layout, leading to inconsistencies between the button label and API request made by Decky Loader.
At first glance I don't see anything wrong. I can't really get the plugin repo to work locally at the moment plus I have to seed it with some data. If someone knows more about issues with the API it would be better for now.