File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -487,12 +487,12 @@ export class NzTreeSelectComponent extends NzTreeBase implements ControlValueAcc
487
487
} else {
488
488
this . value = [ value as string ] ;
489
489
}
490
+ // need clear selected nodes when user set value before updating
491
+ this . clearSelectedNodes ( ) ;
490
492
this . updateSelectedNodes ( true ) ;
491
493
} else {
492
494
this . value = [ ] ;
493
- this . selectedNodes . forEach ( node => {
494
- this . removeSelected ( node , false ) ;
495
- } ) ;
495
+ this . clearSelectedNodes ( ) ;
496
496
this . selectedNodes = [ ] ;
497
497
}
498
498
this . cdr . markForCheck ( ) ;
@@ -708,4 +708,10 @@ export class NzTreeSelectComponent extends NzTreeBase implements ControlValueAcc
708
708
this . triggerWidth = this . cdkOverlayOrigin . elementRef . nativeElement . getBoundingClientRect ( ) . width ;
709
709
}
710
710
}
711
+
712
+ clearSelectedNodes ( ) : void {
713
+ this . selectedNodes . forEach ( node => {
714
+ this . removeSelected ( node , false ) ;
715
+ } ) ;
716
+ }
711
717
}
You can’t perform that action at this time.
0 commit comments