[BUG] undo prepend(shift from array) cause visible position change
See original GitHub issueDescribe the bug
prepending to items using firstItemIndex maintain the visible position, but undo prepending cause the visible position change. (items move up because of above items removed)
To Reproduce Steps to reproduce the behavior:
- go to the sandbox
- click ‘prepend’: it’s okay.
- click ‘unprepend’: visible position change.
Expected behavior click ‘unprepend’: visible position maintain.
Desktop (please complete the following information):
- OS: macOS
- Browser: Chrome
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Remove Object from Array using JavaScript - Stack Overflow
You can use several methods to remove item(s) from an Array: //1 someArray.shift(); // first element removed //2 someArray = someArray.slice(1); // first ......
Read more >Array.prototype.shift() - JavaScript - MDN Web Docs
The shift() method removes the first element from an array and returns that removed element. This method changes the length of the array....
Read more >5. Working with Arrays and Loops - JavaScript Cookbook [Book]
An array is an ordered collection of elements. In JavaScript, an array can be created using formal object notation, or it can be...
Read more >Observable Arrays - Knockout.js
shift () — Removes the first value from the array and returns it. reverse() — Reverses the order of the array and returns...
Read more >Excel Error Cannot Shift Objects Off Sheet - Contextures
How to fix Excel error, Cannot Shift Objects Off Sheet or Can't push objects off sheet. Simple shortcut, or make small change to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Should be fixed in e861fe9acea5b2cbb425b35b2fac75aaff8c0c13
This is a workaround, I use
scrollToto adjust scroll position after deleting items. it seems works but I suspect it may cause some flash effect (i.e. items moving up and down) when things got complicated. And it will also be painful if the row height is changeable. https://codesandbox.io/s/sandpack-project-forked-ikdle3?file=/App.js