File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -115,13 +115,18 @@ export const replaceAction = <UserData extends Data>(
115
115
return walkTree < UserData > (
116
116
state ,
117
117
( content ) => content ,
118
- ( childItem ) => {
118
+ ( childItem , path ) => {
119
+ const pathIds = path . map ( ( p ) => p . split ( ":" ) [ 0 ] ) ;
120
+
119
121
if ( childItem . props . id === action . data . props . id ) {
120
122
return action . data ;
121
123
} else if ( childItem . props . id === parentId ) {
122
124
return childItem ;
123
125
} else if ( idsInPath . indexOf ( childItem . props . id ) > - 1 ) {
124
- // This node is in the path of the target node
126
+ // Node is parent of target
127
+ return childItem ;
128
+ } else if ( pathIds . indexOf ( action . data . props . id ) > - 1 ) {
129
+ // Node is child target
125
130
return childItem ;
126
131
}
127
132
You can’t perform that action at this time.
0 commit comments