-
-
Notifications
You must be signed in to change notification settings - Fork 980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
acceptHMRUpdate skips optional attributes without default values #2611
Comments
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 |
Sounds to me like your proposed solution would keep the other use case of removing a property intact, right? |
I do need to check that PR. Currently we won’t be able to release a new version of pinia soon because of other changes 🥲 |
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: