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 useDispatch with useQuery/request #6316

Closed
22 tasks done
Tracked by #6004 ...
rithviknishad opened this issue Sep 21, 2023 · 1 comment · Fixed by #8731
Closed
22 tasks done
Tracked by #6004 ...

🛠️ Replace useDispatch with useQuery/request #6316

rithviknishad opened this issue Sep 21, 2023 · 1 comment · Fixed by #8731
Assignees

Comments

@rithviknishad
Copy link
Member

rithviknishad commented Sep 21, 2023

❕ Do not assign this EPIC to yourself. Sub-issues specified below can be assigned to yourself.

Currently, we are using useDispatch to dispatch actions through fireRequest. We need to migrate this to use useQuery (for performing GET requests on component mount) and request to perform API calls of other methods (such as form submissions, etc.)

📖 References for the request and useQuery data fetching utilities

Tasks

Feel free to split these individual tasks further into multiple sub-tasks/PRs if the refactor is large. It will be easier to do the refactor, QA testing, and code review.

Steps to follow

  1. Perform a global search with from "react-redux" and specify the corresponding files to include regex as shown
image
  1. In all of the files in the search results, you'll have to remove the usage of useDispatch (and corresponding actions that are dispatched) and replace it with useQuery and request appropriately.

  2. All of the existing routes are available at src/Redux/api.tsx which can be passed to the useQuery/request directly.

  3. For each route that is being used, ensure the response type is also present. If not, you'll have to add it.

Example:

config: {
  path: "/config.json",
  noAuth: true,
  TRes: Res<IConfig>(),  // 👈 Add this
},
  1. Delete the relevant no longer used actions from actions.tsx. (Ensure the action is not used outside the scope of the migration too)

  2. You'll also need to add cypress tests if existing cypress tests do not cover pages/components where the replacements are being done.

@syedfardeenjeelani
Copy link
Contributor

hi @rithviknishad i would like to try to work on this can you please assign this to me

@rithviknishad rithviknishad removed the EPIC label Oct 7, 2024
@rithviknishad rithviknishad self-assigned this Oct 7, 2024
@rithviknishad rithviknishad moved this from In Progress to Review required in Care Oct 7, 2024
@github-project-automation github-project-automation bot moved this from Review required to Done in Care Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants