pmndrs / valtio

🧙 Valtio makes proxy-state simple for React and Vanilla
https://valtio.dev
MIT License
9.16k stars 257 forks source link

Deleting from array doesn't change array size #186

Closed BB-19 closed 3 years ago

BB-19 commented 3 years ago

Similar to #7:

Observed behavior

Deleting an item from a list doesn't update the list size, instead makes the deleted item "undefined".

See example: https://codesandbox.io/s/valtio-array-delete-issue-r2dty?file=/src/App.js

  1. Press on the list items to try to delete them -> Will remove the content of the list item, but not the item itself.
  2. Replace the onClick "del" function with "delReplace" and try again. -> Will actually remove the item as the entire array is replaced every time.
BB-19 commented 3 years ago

nevermind that is default JS behavior :D