CodeHowlerMonkey / hitfactor.info

HitFactor.info -- Howler Monkey Classifiers
https://www.hitfactor.info
11 stars 4 forks source link

Consistent URLs for filters/sort/page/etc #9

Open CodeHowlerMonkey opened 8 months ago

CodeHowlerMonkey commented 8 months ago

Right now, things like filters, pagination, and sort aren't reflected in the URL.

It's not super hard to support this, but it requires significant effort for not-so-much of a reward (quick linking for sending your analysis data sources to someone else for discussion / review).

Parking this as a known issue / TODO / improvement

CodeHowlerMonkey commented 7 months ago

Ideally this should be achieved in a generic fashion, with something like

const [page, setPage] = useQueryParamState('page', 1) used inside of useTablePagination() and useTableSort()

for filters this new state hook probably can be used directly in the components where filter's useState() is called.

internal implementation of useQueryParamState() ideally should fully rely on useSearchParams() from react-router-dom and not store any state anywhere else other than router

effort is really on a lower side of mid, should be good for someone learning react tbh