decky-loader icon indicating copy to clipboard operation
decky-loader copied to clipboard

[BUG] Reverse sort order in Decky Store

Open psxlover opened this issue 8 months ago • 4 comments

Please confirm

  • [x] I have searched existing issues
  • [x] This issue is not a duplicate of an existing one
  • [x] I have checked the common issues section in the readme file
  • [ ] I have attached logs to this bug report (failure to include logs will mean your issue may not be responded to).

Bug Report Description

When accessing the Decky Store, the order of the plugins seems to be the opposite of what is selected in "Sort" option. For example with

  • Alphabetical (A to Z) the first plugin I see is vibrantDeck followed by steamdeck-input-disabler
  • Alphabetical (Z to A) the first plugin I see is "Animation Changer"
  • Least Downloaded First starts with SteamGridDB
  • Most Downloaded First starts with "XIVOmega" which is a plugin for a specific game, followed by "Decky Zerotier" which I've not seen before so I assume it's a relative new plugin and thus would have anong the lowest amount of downloads

Expected Behaviour

Exactly the opposite. "Animation Changer" should be first in "A to Z" and I assume SteamGridDB is the most downloaded plugin, not the least downloaded one.

SteamOS version

3.6.24

Selected Update Channel

Stable

Decky Loader Version

v3.1.5

Plugin Info

  • ProtonDB Badges - 1.1.0
  • IsThereAnyDeal for Deck - 1.0.3
  • Free Loader - 1.3.0
  • HTLB for Deck - 2.0.4
  • EmuDecky - 1.0.8
  • SteamGridDB - 1.5.1-loaderv2
  • Syncthing - 0.2.1
  • Decky-Lookup - 0.1.0

Have you modified the read-only filesystem at any point?

No response

Backend Logs

Currently no backend logs

Frontend Logs

Currently no frontend logs

psxlover avatar Apr 11 '25 21:04 psxlover

const dropdownSortOptions = useMemo(
    (): DropdownOption[] => [
      // ascending and descending order are the wrong way around for the alphabetical sort
      // this is because it was initially done incorrectly for i18n and 'fixing' it would
      // make all the translations incorrect
      { data: [SortOptions.name, SortDirections.ascending], label: t('Store.store_tabs.alph_desc') },
      { data: [SortOptions.name, SortDirections.descending], label: t('Store.store_tabs.alph_asce') },
      { data: [SortOptions.date, SortDirections.ascending], label: t('Store.store_tabs.date_asce') },
      { data: [SortOptions.date, SortDirections.descending], label: t('Store.store_tabs.date_desc') },
      { data: [SortOptions.downloads, SortDirections.descending], label: t('Store.store_tabs.downloads_desc') },
      { data: [SortOptions.downloads, SortDirections.ascending], label: t('Store.store_tabs.downloads_asce') },
    ],
    [],
  );

imho this part is fishy

RieLCho avatar Apr 22 '25 11:04 RieLCho

As the comment says, the name sorting labels are the other way around because that's how they are in the localization files, e.g. https://github.com/SteamDeckHomebrew/decky-loader/blob/e646168e31fe01df4ec3c369db60ceac3527a0ed/backend/decky_loader/locales/en-US.json#L253-L262 Problem is that all of the options seem to have the opposite effect of what is expected so issue is most likely in the sorting.

psxlover avatar Apr 22 '25 12:04 psxlover

Oh, So problem here is nothing to do with frontend. https://github.com/SteamDeckHomebrew/decky-loader/blob/e646168e31fe01df4ec3c369db60ceac3527a0ed/backend/decky_loader/utilities.py#L356-L375

I'm not familliar to python backend, but python's sort() reverse parameter seems descending while true

Both list.sort() and sorted() accept a reverse parameter with a boolean value. This is used to flag descending sorts.

https://docs.python.org/3.13/howto/sorting.html#ascending-and-descending

so

rev = False if ord_arg[1] == "asc" else True or case 'name': files.sort(key=lambda x: x['file'].name.casefold(), reverse = not rev) folders.sort(key=lambda x: x['file'].name.casefold(), reverse = not rev)

seems right i guess...

EDIT: this is filepicker_ls function so nvm

RieLCho avatar Apr 22 '25 12:04 RieLCho

https://plugins.deckbrew.xyz/plugins?sort_by=name&sort_direction=asc (should be A -> Z) Image (response with Z->A)

https://plugins.deckbrew.xyz/plugins?sort_by=name&sort_direction=desc (should be Z -> A) Image (response with A->Z)

So this issue is on API server that I couldn't reach out which needs help from maintainers

RieLCho avatar Apr 23 '25 13:04 RieLCho