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
The problem is that the removal of the property sign could be intentional so I'm not sure if this is with changing as it would break other HMR cases.
In order to change this behavior, one could get each property with toRaw(newStore.$state) and check if the property is a ref in order to completely replace it rather than patchObject
Sounds to me like your proposed solution would keep the other use case of removing a property intact, right?
I think it should also work for us.
Normally I would be happy to contribute a PR, but given that my previous PR is still open and we are thus unable to use the latest pinia version, I am not sure how to proceed here 😐
Reproduction
https://github.com/bodograumann/pinia-hmr-optional-attributes
Steps to reproduce the bug
git clone https://github.com/bodograumann/pinia-hmr-optional-attributes
cd pinia-hmr-optional-attributes
npm install
npm run dev
xdg-open http://localhost:5173
touch src/store/counter.ts
Expected behavior
All the state should be preserved.
Actual behavior
counter.nr
is preserved as1
, butcounter.sign
is lost. The page shows-
, while it should showpositive
.Additional information
The relevant code is here:
pinia/packages/pinia/src/hmr.ts
Lines 41 to 43 in 93b5546
The text was updated successfully, but these errors were encountered: