File list wrongly sorted when inserting new elements when hidden elements present #25309

Closed
PVince81 opened this Issue Jun 30, 2016 · 5 comments

Projects

None yet

1 participant

@PVince81
Collaborator

Steps

  1. Create a folder ".hidden"
  2. Create a folder "def"
  3. Refresh the page, the folder ".hidden" must disappear
  4. Create a folder "abc"

Expected result

Order is: "abc", "def"

Actual

Order is: "def", "abc" until refresh.

Version

9.1.0RC1

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.

CC @ChristophWurst

@PVince81 PVince81 added this to the 9.1-current milestone Jun 30, 2016
@PVince81 PVince81 added the app:files label Jun 30, 2016
@PVince81
Collaborator

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.

@PVince81
Collaborator

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.

@PVince81
Collaborator

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:

  • ".hidden" (hidden)
  • "abc"
  • "def"
  • "welcome.txt"

Delete "abc". But the index is shifted, so it deletes another one and nextPage suddenly renders "welcome.txt" again.

@PVince81 PVince81 self-assigned this Aug 17, 2016
@PVince81
Collaborator

WIP PR here #25846

@PVince81
Collaborator

Fix is here #25856

@PVince81 PVince81 closed this in #25856 Aug 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment