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] Add cache to resolve hook to allow for efficient larger queries #54

Open
4 tasks
fotmjay opened this issue Oct 20, 2023 · 0 comments
Open
4 tasks

Comments

@fotmjay
Copy link

fotmjay commented Oct 20, 2023

Problem

Considering hooks can't be used conditionally, parsing through a large list of domains (or addresses) to fetch their counterpart will lead to multiple re-fetch of the same addresses/domains. Currently, this could be circumvented by not using the hook and instead using the vanilla implementation along with a cache.

Proposed Solution

Add a cache state to the hooks, preserving the truthiness (official latest current value) while reducing stress on the router for any doubles.

Implementation

  • Adding a domain cache state to the hook.
  • Verifying the cache before fetching the data.
  • Returning the cache instead of newly fetched data.
  • Updating the cache with the result whenever a domain/address is fetched.

If you think this would be a good addition , you may assign it to me. I can work on it.

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

No branches or pull requests

1 participant