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

Infinite Retries on failed load #1

Open
leewardbound opened this issue Jul 30, 2019 · 0 comments
Open

Infinite Retries on failed load #1

leewardbound opened this issue Jul 30, 2019 · 0 comments

Comments

@leewardbound
Copy link
Collaborator

Seems to work great when working against valid URLs with responses; however, currently issuing infinite URL retries when the content is invalid or fails to load.

We tried to prevent this by keeping startTime as a state variable in the hook itself, which when checked with requestOnce helps ensure that only one request is sent; sadly it seems (I'm still learning hook-foo) that startTime isn't getting set properly, or the hook is otherwise dying/aborting and the component is remounting every time.

The first proposed solution is to figure out how to not-reload-the-hook upon fetch() failures; If we can't figure out how to not-reload-the-hook, the next step is probably to create a global const HTTPRequest = React.createContext() and share global state across all the hooks to make sure we're being nice to external services.

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