File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 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
487487 } else {
488488 this . value = [ value as string ] ;
489489 }
490+ // need clear selected nodes when user set value before updating
491+ this . clearSelectedNodes ( ) ;
490492 this . updateSelectedNodes ( true ) ;
491493 } else {
492494 this . value = [ ] ;
493- this . selectedNodes . forEach ( node => {
494- this . removeSelected ( node , false ) ;
495- } ) ;
495+ this . clearSelectedNodes ( ) ;
496496 this . selectedNodes = [ ] ;
497497 }
498498 this . cdr . markForCheck ( ) ;
@@ -708,4 +708,10 @@ export class NzTreeSelectComponent extends NzTreeBase implements ControlValueAcc
708708 this . triggerWidth = this . cdkOverlayOrigin . elementRef . nativeElement . getBoundingClientRect ( ) . width ;
709709 }
710710 }
711+
712+ clearSelectedNodes ( ) : void {
713+ this . selectedNodes . forEach ( node => {
714+ this . removeSelected ( node , false ) ;
715+ } ) ;
716+ }
711717}
You can’t perform that action at this time.
0 commit comments