nuxt: NuxtServerInit may be have a major problem
Have a code
nuxtServerInit({ commit }){
commit('setNumber', Math.random());
}
If there are two people at the same time online Suppose they get 0.1 and 0.2 on the server But they get the same value on the browser When they use {{ number }} They will show the same value That is to compare the later one
<div align="right">This question is available on Nuxt.js community (#c2179)</div>About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 25 (7 by maintainers)
We are also facing the same issue. Server side the data is correct. But on client side, identical data is showing up for different users. Request you to please fix this at the earliest.
@msahajwani Does your
./stateexport a object ? If so, you can change it to a function, such as:@clarkdo The code steps are no problem You have to print the data on the client side
Then let two people connect at the same time ( wait ten seconds should be within ten seconds ) Maybe can reproduce my problem You will get two different data on the server side You will gett wo identical data on the client side ( browser )
Please confirm to see if you can reproduce this problem