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
- Press the "Increment" button. Sign says "positive".
touch src/store/counter.ts
Expected behavior
All the state should be preserved.
Actual behavior
counter.nr is preserved as 1, but counter.sign is lost. The page shows -, while it should show positive.
Additional information
The relevant code is here:
|
if (!(key in newState)) { |
|
continue |
|
} |
Reproduction
https://github.com/bodograumann/pinia-hmr-optional-attributes
Steps to reproduce the bug
git clone https://github.com/bodograumann/pinia-hmr-optional-attributescd pinia-hmr-optional-attributesnpm installnpm run devxdg-open http://localhost:5173touch src/store/counter.tsExpected behavior
All the state should be preserved.
Actual behavior
counter.nris preserved as1, butcounter.signis 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