ant-design-vue icon indicating copy to clipboard operation
ant-design-vue copied to clipboard

loadData prop is not called after a Tree node, which was previously expanded manually, is expanded from the code

Open YuLogun opened this issue 1 year ago • 0 comments

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.2.2

Environment

Vue ^3.2.33

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  1. Expand the first Tree node by clicking on the arrow.
  2. Press the button "Reset loaded keys". It clears expandedKeys and loadedKeys for the Tree component.
  3. Press the button "Load first node". It expands the fist node by setting expandedKeys value to ["0"]. As a result, the first node with key "0" expands, however, loadData function is not called for the node this time.
  4. If you press the button "Reset loaded keys" again and then manually open the first node, loadData prop gets called and new children appear.

Screencast https://drive.google.com/file/d/1R7ZkhqYLZ6n44GCSa361YzNR0MpK_vFN/view?usp=sharing

What is expected?

If a tree node was previously expanded manually (eg. by clicking on it with a mouse) and after being closed it is expanded once more but from the code this time, the function from the loadData prop should be fired so as to refetch node's children.

What is actually happening?

At the moment if a tree node was previously expanded manually (eg. by clicking on it with a mouse) and we need to load its data again after expanding it from the code, the loadData function is not being triggered. In this case it will trigger only if expanding the node by clicking on it.

YuLogun avatar Jun 03 '24 10:06 YuLogun