nens / lizard-catalogue

Lizard Catalogue
https://demo.lizard.net/catalogue/
0 stars 0 forks source link

Investigate on the use of react-query instead of Redux store #284

Closed hoanphungt closed 2 years ago

hoanphungt commented 3 years ago

Currently in the catalogue, backend data is mostly stored in the Redux store, for example:

We can investigate if using react-query will remove some of them from the Redux store and if they can prove to be more efficient than Redux.

Approach:

The approach is to gradually move to react-query in a careful way (from simple places first) and then analyse the impact of this move before making a decision for which technology to use (Redux vs react-query).

hoanphungt commented 3 years ago

Spent 1 day to add react-query to the catalogue and refactor the paginatedFetchFunction to use the recursiveFetchFunction in multiple places. Also try to replace datasets in Redux by react-query but not successful so far due to the filter.

lexvand commented 3 years ago

@hoanphungt Why is this issue in the backlog? Is it partly done and should the rest be picked up later?

hoanphungt commented 2 years ago

Many parts of the Redux store cannot be replaced by React-Query (mostly the filter options) as these informations are shared between many different components. React-Query is best to store API data but in this case, it is more appropriate to store these filter selections in a global state (Redux in this case).

Some other parts that concern data fetching only have already been done with React-Query, e.g. paginated fetches, scenario results.

So I close this ticket as completed.