GerryWilko
GerryWilko
NNuxt
Created by GerryWilko on 7/2/2024 in #❓・help
useState race condition
Hello, I have run across an issue related to updates to useState where updates to the state are not reflected in the SSR result seemingly if there is a navigation event straight after. This presumably is present in other situations too as it seems to be a race condition to do with settlement of the state updates. I have created a simple playground demonstrating the issue. https://codesandbox.io/p/devbox/agitated-butterfly-s78k7s?file=/pages/finish.vue:4,11 If you navigate to the /start page it will redirect you to /finish and you will see the state is "not set". However I have put in a callOnce (just to ensure it is only called once on SSR) an update of this string to another value. This is not serialised into the loaded /finish page. Adding a nextTick wait after the update sorts this on this simple reproduction but on a larger application it seems to be delayed further by something. I'm not sure if it is an issue or there is something more appropriate for us to wait against for this state to be settled before performing the navigation?
4 replies
NNuxt
Created by GerryWilko on 6/28/2024 in #❓・help
Upgrade to nuxt 3.12.2 @nuxt/test-utils issue
No description
7 replies