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

React query implementation #2087

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

bharateshwq
Copy link
Contributor

Description

Fixes #2074

This is still a work in progress.

The API calls on the first page are now managed using react-query. I’ve created three hooks: usePolicy (for baseline and reform), useMetadata, and useUserProfile, which completely eliminate prop drilling and allow data to be accessed wherever it's needed.

Currently, I'm caching the data for three minutes.

I plan to implement react-query for additional API calls in the PolicyPage and HouseholdPage, as I’ve already noticed a slight improvement in the Lighthouse performance rating for the site after my changes.

@anth-volk
Copy link
Collaborator

@bharateshwq I just wanted to confirm with you: is this still a work in progress, or ready for review? Thanks for your work on this.

@bharateshwq
Copy link
Contributor Author

Hey @anth-volk,

I believe it would be better to avoid merging the migration to React Query for all pages in a single PR. Instead, how about we split this issue into multiple PRs? We could create tasks on GitHub similar to this example. This would allow for a more manageable, long-running set of tasks, and you can decide if it’s necessary.

As for this PR, it’s ready for review!

@anth-volk
Copy link
Collaborator

I completely agree. If you'd like to modify the existing issue to break this up however you'd like, please be my guest.

With regard to this PR, would you mind fixing the merge conflicts before I review? If you'd like, I can take them on, but don't want to incorrectly change any of your code additions.

@bharateshwq
Copy link
Contributor Author

yeah sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

Use of React Query for api calls
2 participants