Closed jaybe78 closed 2 years ago
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: https://github.com/facebook/react/issues/24669.
Oh sh*t! . I guess I'll stick to static id for now. Thanks @brillout.
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
https://user-images.githubusercontent.com/3605098/171516199-4526eb50-97f2-4149-8adf-60845ab3ea68.mov
Steps: 1) Click on
About
2) Go back toHome
3) Result: infinite loopI 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