satisfactorymodding / smr-frontend

Next generation Satisfactory Modding Repository (SMR) frontend
https://satisfactorymodding.github.io/smr-frontend/main/
GNU General Public License v3.0
6 stars 24 forks source link

fix: mod grid orderBy search getting overriden by Select and not being set using URL params #96

Closed mircearoata closed 1 year ago

mircearoata commented 1 year ago

orderBy was getting overriden by Select when set to search, because Select would then lookup the value in the Options to update the selectedIndex, but end up with -1, and set orderBy to null/undefined. This was causing the mods query to be sent with order=desc, but without orderBy, which returned an internal server error (report on discord). There are two solutions for this: this PR's, and delaying setting orderBy by one tick, giving Select time to receive the updated Options, but the latter would trigger two separate API requests.

Additionally, the order is set to search on page load, if the search URL parameter is present.