Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
PVince81 opened this issue Jun 30, 2016 · 6 comments · Fixed by #25856
Closed

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

PVince81 opened this issue Jun 30, 2016 · 6 comments · Fixed by #25856

Comments

@PVince81
Copy link
Contributor

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 modified the milestones: 9.1-current, 9.1.1-next-maintenance Jun 30, 2016
@PVince81
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

WIP PR here #25846

@PVince81
Copy link
Contributor Author

Fix is here #25856

@lock
Copy link

lock bot commented Aug 3, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant