-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
Data not populated at mount #368
Comments
+1 @maximelebastard Did you figure out anything? |
@MuzafferDede Nope sorry, I ended up switching to axios-hooks |
@maximelebastard I figured out, It is because of React 18's strict mode. If you turn off, it will be fine or you can rollback to React 17 until this is handled by |
It is happening due to abort on unmount feature Line 243 in 031b2ee
If I remove this line it is working, but it is making duplicate get requests as component mounts, unmounts and remounts again in React 18 StrictMode. Now I'm trying to solve this problem with abort the requests on unmount and making it work in React StrictMode. Please let me know if you have any inputs |
I suppose this is the same issue that I see here. An extract from my functional component:
So I want to execute the effect when data becomes available. UseFetch is run when the component mounts, I can see the response coming back in the console, but the effect is not running. When I do setDate(), useFetch runs again on the new url, and then the effect is executed correctly! Best regards, |
Describe the bug
When using the provided example, no data is populated into the state.
To Reproduce
Use that example
Expected behavior
The data appears into the data attribute
Actual behavior
The request is executed and visible into the Network tab of the Chrome Dev Tools, but no data is put in the state.
The text was updated successfully, but these errors were encountered: