Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Sagas with Tanstack Query #1094

Closed
9 tasks done
Tracked by #339 ...
framitdavid opened this issue Apr 13, 2023 · 2 comments
Closed
9 tasks done
Tracked by #339 ...

Replace Sagas with Tanstack Query #1094

framitdavid opened this issue Apr 13, 2023 · 2 comments
Labels
Epic fe-v4 Issues to be solved before v4 goes gold

Comments

@framitdavid
Copy link
Contributor

framitdavid commented Apr 13, 2023

Sagas in a nutshell:
Redux-Saga was created to handle side effects and async code upon the Redux state. Sagas are functions that listen to redux actions and then run async operations such as fetching data from an API and then mutating the results back to the redux state.

The problem for us
First of all, Sagas has a learning curve for new team members that might be hard for someone. This can lead to unnecessary time-consuming or just a few team members having enough knowledge about the technology. Sagas do also make it possible to over-engineer or create a pattern that complicates the application more than necessary. Sagas is built upon many concepts that needed to be learned to understand Sagas well enough.

The second problem is that this approach forces us to save our data within the Redux State and write a lot of boilerplates and our own code for caching and error handling.

Proposed solution
I propose to do fetching and data mutation with Tanstack Query instead of Redux-Saga. This will give us a lot of benefits such as built-in caching, background-fetching, retries, infinite queries for long lists and much more. We stop writing a lot of boilerplates to handle caching and error handling.

React Query allows us to separate the client state from the data state. Today we have all of our data/server state within the Redux Store and it's normalized in a way that makes it hard to work with, ref. #603

Tanstack Query is using the hooks API and therefore it is very Reactish and increase the developer experience. Hopefully, we can make the codebase smaller and easier to follow when network calls are made. Tanstack Query does also have great DevTools support.

Tasks

Preview Give feedback
  1. fe-v4 quality/debt
    Magnusrm bjosttveit
    lassopicasso
  2. fe-v4 quality/debt
    olemartinorg
  3. fe-v4 quality/debt
    bjosttveit
  4. area/validation fe-v4 quality/debt
    RonnyB71 bjosttveit
    tjololo
  5. fe-v4 quality/debt
    olemartinorg
  6. fe-v4 quality/debt
    mikaelrss
  7. fe-v4 quality/debt
    bjosttveit
  8. fe-v4 quality/debt
  9. fe-v4 quality/debt
    olemartinorg
@framitdavid framitdavid converted this from a draft issue Apr 13, 2023
@framitdavid framitdavid added the status/draft Status: When you create an issue before you have enough info to properly describe the issue. label Apr 13, 2023
@RonnyB71 RonnyB71 added the Epic label Jun 29, 2023
@RonnyB71 RonnyB71 removed the status/draft Status: When you create an issue before you have enough info to properly describe the issue. label Oct 3, 2023
@RonnyB71 RonnyB71 moved this to 👷 In Progress in Team Apps Oct 9, 2023
@RonnyB71 RonnyB71 mentioned this issue Nov 22, 2023
Closed
@RonnyB71 RonnyB71 added the fe-v4 Issues to be solved before v4 goes gold label Nov 22, 2023
@olemartinorg olemartinorg moved this from 👷 In Progress to ✅ Done in Team Apps Jan 24, 2024
@olemartinorg
Copy link
Contributor

Closing as done! 🥳

@framitdavid
Copy link
Contributor Author

Closing as done! 🥳

Solid work! 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Epic fe-v4 Issues to be solved before v4 goes gold
Projects
Archived in project
Development

No branches or pull requests

3 participants