loadDynData does not remove old file when name was updated

If we try to refresh current branch via loadDynData when file name was updated, we get duplicates i.e file with old name and renamed file will be visible in the folder. The old file disappears only if I reload the browser.

Expected behavior:
If we rename file A to file B, only file B should be visible after refresh (loadDynData)

Actual behavior:
If we rename file A to file B, both file A and file B are visible in the folder after refresh (loadDynData)

This is how we refresh current folder data:

loadData = () => {
    const proxy = this.ui.config.handlers.branch;
    const selectedItem = this.ui.$$('tree').getSelectedItem();
    this.ui.loadDynData(proxy, selectedItem, 'branch');
  };

Hello @olzhas,

This is how we refresh current folder data

Is there any particular reason why you are using the loadDynData method directly? In most cases, the direct use of this method is unnecessary, as this method is already being called automatically by the appropriate handlers.

For example, in the case of branch mode, the handlers can be specified as follows: https://snippet.webix.com/yr2ybub4. With these handlers specified, all that is left is to send back the correct response from the server (you can see the correct response format here, look at the “Rename” section in particular). Please note that the id contained in the server response should also match the id of the original file.

If there is indeed a good reason that justifies the use of this method, there is a way around the issue you are having. You can manually clear out the old data just before the new data is loaded: https://snippet.webix.com/ymiff6a8.

Hi @Dzmitry,

Thanks for reply. Apart from standard rename action, we also have our custom modal window, in which one can edit file name along with other data. Based on https://forum.webix.com/discussion/6684/how-can-i-reload-data-of-filemanager, we decided to use loadDynData which seemed to meet our needs.
Please note that standard Rename action works just fine. Our goal is to be able edit file names via our custom modal.

The solution you provided (onBeforeDynParse) helped to resolve the issue with duplicates. Thank you!