GetDKAN / data-catalog-components

https://getdkan.github.io/data-catalog-components
9 stars 6 forks source link

Add sortDefaults to datatable to fix initial useEffect reseting sort #168

Closed dgading closed 2 years ago

dgading commented 2 years ago

If a datatable was mounted that had an initial sort this was lost after the useEffects first pass. This wouldn't show on the until the data was updated, through something like pagination change. The setSort in the component would pass the blank sortBy state from the react-table back to the Resource prop. This update allows for a custom default sort to be passed to react-table on initialization to stop this from happening.