Skip to content

loadLazyChildren error #387

Closed
Closed
@chengchencc

Description

@chengchencc

Reporting a Bug?

i try to use children lazy load refer to Fix loadLazyChildren with children as function but not work.

i read the source code,find this change in react-sortable-tree.js(row number 150):
` static getDerivedStateFromProps(nextProps, prevState) {
const { instanceProps } = prevState;
const newState = {};

// make sure we have the most recent version of treeData
instanceProps.treeData = nextProps.treeData;
if (!isEqual(instanceProps.treeData, nextProps.treeData)) {
  if (instanceProps.ignoreOneTreeUpdate) {
    instanceProps.ignoreOneTreeUpdate = false;
  } else {
    newState.searchFocusTreeIndex = null;
    ReactSortableTree.loadLazyChildren(nextProps, prevState);
    Object.assign(
      newState,
      ReactSortableTree.search(nextProps, prevState, false, false, false)
    );
  }


instanceProps.treeData = nextProps.treeData;
if (!isEqual(instanceProps.treeData, nextProps.treeData))
`
this will be always equal. the code can not going into the if.

if this change cause bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions