Skip to content

Commit

Permalink
Merge pull request #6100 from HCL-TECH-SOFTWARE/Tree_Drop_throw_error…
Browse files Browse the repository at this point in the history
…_6048

Fix #6048: Avoid throwing error while drop on tree component
  • Loading branch information
nitrogenous authored Mar 14, 2024
2 parents 763c4e6 + bb1d5b9 commit 2a7172a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/lib/tree/Tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const Tree = React.memo(
};

const onDrop = (event) => {
if (validateDropNode(dragState.current.path, event.path)) {
if (validateDropNode(dragState.current?.path, event.path)) {
const value = cloneValue(props.value);
let dragPaths = dragState.current.path.split('-');

Expand Down Expand Up @@ -210,7 +210,7 @@ export const Tree = React.memo(
};

const validateDropPoint = (event) => {
let _validateDrop = validateDrop(dragState.current.path, event.path);
let _validateDrop = validateDrop(dragState.current?.path, event.path);

if (_validateDrop) {
//child dropped to next sibling's drop point
Expand Down

0 comments on commit 2a7172a

Please sign in to comment.