You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When any code is changed and an hmr update is performed,
Select function of useQuery runs multiple times
new component(module) with the new state [EXPECTED BEHAVIOR]
old component(module) with old state [UNEXPECTED]
new component(module) with the new state [EXPECTED because of no. 2]
In the image -
selector executed with 1000 is the data returned from an async queryFn with 1000,
n is select function local variable
new value is from console.log in component
this issue also occurs in react native which uses webpack for hmr, and the provided link uses vite for hmr
Narrowing down from there if problem was related to hmr, I dont have the experience for that.
react rerendering does not execute select but only when the hmr is updated we find the unexpected old component
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When any code is changed and an hmr update is performed,
Select function of useQuery runs multiple times
In the image -
selector executed with 1000 is the data returned from an async queryFn with 1000,
n is select function local variable
new value is from console.log in component
this issue also occurs in react native which uses webpack for hmr, and the provided link uses vite for hmr
Narrowing down from there if problem was related to hmr, I dont have the experience for that.
react rerendering does not execute select but only when the hmr is updated we find the unexpected old component
Reproducible code Demo - https://stackblitz.com/edit/vitejs-vite-9ptx7kbu?file=src%2FChild.tsx
Beta Was this translation helpful? Give feedback.
All reactions