File manager - bug with rename folder (duplicate folders)

Hello,

I found very strange bug, and it is easy to reproduce (on yours sample):

  1. Open two tabs on browser with link https://docs.webix.com/samples/64_file_manager/04_loading/03_dynamic_loading_nocache.html#!//
  2. Click for example on folder “newFolder” (on both tab)
  3. Rename some inner folder in that folder (for example “newFolderInner1” to “newFolderInner12”)
  4. On that tab (where you rename), everything is correct. But, on second tab, when you load branch again (for example, click on parent root and then on folder “newFolder”), you will have “newFolderInner1” and also “newFolderInner2”.

Setup that I use is loading with branch, noFileCache on true, and also I use “removeMissed” on true, but everything is same. Also, on rename files, everything is ok. I think that problem is because “loadBranch” don’t clear folders.

If you have some quick solution, please write, but, I’m sure that you will correct this bug on next version :slight_smile:

Best regards,
Stefan

Hey @Stefan, looks like this is actually not a bug per se, but more of a back-end related behaviour and the way file manager works overall. The thing is, when you rename a folder it gets assigned a new id in this case, for instance we’ve had:

{ "value":"test", "id":"/newFolder/test", "type":"folder" }

and after we renamed our folder the id has changed:

{ "value":"test_new","id":"/newFolder/test_new", "type":"folder" }

So in our second tab the file manager thinks we’re getting a new item instead of updating the old one. If the id was to remain the same, our folder would get updated in this case just fine and you wouldn’t see an extra folder.

The removeMissed property doesn’t work in this case since it was meant to be used by views with linear data, so it doesn’t work in this case. We’ll remove it from our documentation, sorry for the confusion.

Hello @Dzmitry,

Thanks for your answer. Yes, I know that happens because rename operation changes ID, but I can’t agree that’s expected behaviour when you rename a folder. Rename file works correctly, and one would expect similar behaviour.

There are a lot of situations where this bug causes problems. Couple of examples:

  • If other users are also viewing parent of that folder, they will also see two different folders.
  • If user deletes folder, other users whom are viewing parent folder will see deleted folder as long as they don’t close file manager dialog/tab.
  • On cut/paste folder operation, other users will see folder as long as they don’t close file manager dialog/tab.

Is it possible to add an atribute like “removeMissed”? Or is there any other solution because this is not normal behaviour.

Best regards,
Stefan

Hi Stefan,

is there any other solution because this is not normal behaviour.

Yep, I can confirm that the branch data is not properly cleared before reloading, that’s why it is possible to see the non-existent folders. We will adjust the logic in one of the next releases.

Thank you for reporting!

P.S. As a temp woraround, you can clear folders before reloading the data into them: https://snippet.webix.com/jgajd1dd