-
Notifications
You must be signed in to change notification settings - Fork 12
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 loop when fetching data with useAsync()
#9
Comments
It should actually work with Client Routing. Reproduction is welcome and I'll have a look. |
@brillout Done ! Thanks |
I could reproduce, I'll have a look at it tomorrow. |
It's a React bug: facebook/react#24669. |
Oh sh*t! . I guess I'll stick to static id for now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm using
client routing
invps
, and when switching to a page that has a component withuseAsync()
, I can see inuseSsrData
, that (obviously) it creates a newkey
that is different than the initialkey
created at first load(server side).Thus, the data in the html tree is never found, then creates a new
promise
, throws the state, that triggers the update ofsuspense
, which triggers the update of thewrapped
component, and so there's an infinite loop... :UseAsync
client side if id has not been created server sideI think the documentation should make it clear, that
useAsync
only works when you are coming from the server, so only forserver routing
, otherwise onlyuseSSRData
is indicated with a static id.git clone git@github.com:jaybe78/vps-webpack5-redux-streaming-test.git
npm install
npm run dev
Screen.Recording.2022-06-02.at.00.08.52.mov
Steps:
About
Home
I tried with
react-router
as well using the example you added invite-plugin-ssr
. I get the same issue this time on first load. https://github.com/jaybe78/vps-webpack5-redux-streaming-test/pull/1/filesThough I confirm in both cases it works, if I replace
by
The text was updated successfully, but these errors were encountered: