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

provide routes the option to have their props refetched each time the… #488

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

infiton
Copy link

@infiton infiton commented May 10, 2023

@airhorns putting this up to get you take on if this is the right approach

@airhorns
Copy link
Collaborator

Yeah this looks like the right approach to me! I think the most react-y way to implement usePromise to actually pay attention to the refetch param would be to use that refetch object in a dependencies array of a useEffect or similar. I didn't try it but I think what you have would work as well.

@infiton
Copy link
Author

infiton commented May 11, 2023

The current approach won't work, from facebook/react#17526

The result is then cached. This cache is “append-only”: once we put the fetched data into the cache, we never mutate or remove it. (There is a separate mechanism for invalidation in React itself, which amounts to replacing the cache with an empty one — see https://github.com/reactwg/react-18/discussions/25 for an early look.)

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

Successfully merging this pull request may close these issues.

2 participants