Order is: "abc", "def"
Order is: "def", "abc" until refresh.
The problem is that the code that inserts new elements into the list calculates the insertion index. That routine seems to not properly cope with hidden elements.
Now looking at the hidden files implementation, it seems to do a lot of gymnastics.
Maybe it would have been simpler to always render the rows, but set a special class on it for hidden files.
Then in nextPage, continue rendering until enough visible (non-hidden) elements are appended.
Then toggling between showing hidden files and not hidden files would just be a matter of toggling a CSS class on the table element.
Anyway, in the future I'd like to look into making the FileList use the Backbone approach, which would need rewriting a lot of logic anyway.
It's even worse than I thought. In the past there was a one to one index mapping between "tr" elements and fileList.files but now we can't rely on this any more. This means that when a shifted file is deleted, the list reloads the page wrong.
Have four entries:
Delete "abc". But the index is shifted, so it deletes another one and nextPage suddenly renders "welcome.txt" again.
WIP PR here #25846
Fix is here #25856