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

Ensure useFetch suspends when triggering a service call more than once #396

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thegoobs
Copy link

@thegoobs thegoobs commented Oct 4, 2024

useFetch experimental support for React Suspense works great when the call made is only used once. In the event of an application successfully suspending after a service call, and then triggering that same call again, the suspense mechanism does not suspend as expected. This is because the suspenseStatus ref used to keep track of the suspense status is never reset! This change makes it so that when the suspense promise is created, the suspenseStatus ref is reset so that the promise can be successfully thrown for React to catch.

useFetch experimental support for React Suspense works great when the call made is only used once. In the event of an application successfully suspending after a service call, and then triggering that same call again, the suspense mechanism does not suspend as expected. This is because the suspenseStatus ref used to keep track of the suspense status is never reset! This change makes it so that when the suspense promise is created, the suspenseStatus ref is reset so that the promise can be successfully thrown for React to catch.
@thegoobs
Copy link
Author

thegoobs commented Oct 4, 2024

Not sure how to assign anyone to this PR to get the ball rolling, but I do fear that this might not be maintained as closely as it has been in the past. @alex-cory hoping that you can get some eyes on this soon!

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.

1 participant