batch() does not work with multiple Array.splice operations
Describe the bug
Using <For> on an array and updating that array inside a batch() throws errors indicating that <For> tries to render an undefined item. It looks a bit like #960 where it creates "holes" in the array.
Applying multiple splice on the same array without batch works fine.
Your Example Website or App
https://playground.solidjs.com/?version=1.4.1#NobwRAdghgtgpmAXGGUCWEwBowBcCeADgsrgM4Ae2YZA9gK4BOAxiWGjIbY7gAQi9GcCABM4jXgF9eAM0a0YvADo1aAGzQiAtACsyAegDucAEYqA3EogcuPfrwBi3LLxNRczABZTZ8xSroNbT0LKxtuPgFmIXc4AFl6XCgTNTgfOQVlVSDdAzJcbjhQiCtmWgh83gBJXDhFAF5eAApCeUIyRHtNToh6GBNxc15ailxO-MYMAHMpAEpeeoA+fiteQThcJgheAB4NXhF3KC1NepBW2naAOk1JRfO2siuR3Ekd-Q1FywhJb6sZegQZi4NDlXgAQUIhCa8xAq14ZQqfHysQWCJitQSSRScCacO2awOR06+MJhK8aDUIiEEE6wHhZLWAm6vAAjC4Xp0VKyVFIsAzGcyRJ0AEwcuCjLlgEW8yT8gmMrrC3gAZnFkqyKtl8sVAF0dYS5fDJLM-gSAUCQWCyIYoNDYQK3B5PE0YQtlqTGYjKjBaAA3NKNFG1K6HJJXClUmlXMiEDSsJrstmmgVrYNwUNHCOeSnU4QxuNoBMABhcpd4V0rvoDKYVc2+a0kVnhQk2jG2TQFOxEaD9i1Tu3oan7dbJOycEjgUC8Z3TmfDkbzPxHirJICaaFqMHmS12NTqvFOIE3dRuImkLzOJ5gzwlr14+kWTdHhPeE5XjPeQ4-Y5MiQK2zlMw8YANazrahB3AAyhB7x-rgAE-rs+g9n28K1s+Vg0mIjCujuyw7JChAPosLgiLQzB9MIuBXFMGwAKKpPAEC4AAQvgVQiJ2YB2oQKizAAhLWYCSLqQA
Steps to Reproduce the Bug or Issue
See the Codepen. If you remove the batch call on line 21 then everything works fine.
Expected behavior
Multiple splice calls on the same array should work inside a batch.
Screenshots or Videos
No response
Platform
- macOS
- Chrome
- 100
Additional context
No response
This is actually a tricky issue and oversight on my part. The correct behavior and desired behavior are miles away from each other and I think it is time to address it. There is a bug here. There shouldn't be holes. But technically your first splice should get ignored the way batching works in Solid. You should end up with a 4 item array. But that also makes no sense for people. So its time to address what our batching behavior should look like.