@@ -29,7 +29,7 @@ import { IgxTreeNodeComponent } from './tree-node/tree-node.component';
2929import { IgxTreeSelectionService } from './tree-selection.service' ;
3030import { IgxTreeService } from './tree.service' ;
3131import { growVerIn , growVerOut } from 'igniteui-angular/animations' ;
32- import { resizeObservable } from '../core/utils' ;
32+ import { PlatformUtil , resizeObservable } from '../core/utils' ;
3333
3434/**
3535 * @hidden @internal
@@ -327,6 +327,7 @@ export class IgxTreeComponent implements IgxTree, OnInit, AfterViewInit, OnDestr
327327 private selectionService : IgxTreeSelectionService ,
328328 private treeService : IgxTreeService ,
329329 private element : ElementRef < HTMLElement > ,
330+ private platform : PlatformUtil
330331 ) {
331332 this . selectionService . register ( this ) ;
332333 this . treeService . register ( this ) ;
@@ -501,9 +502,13 @@ export class IgxTreeComponent implements IgxTree, OnInit, AfterViewInit, OnDestr
501502 private subToChanges ( ) {
502503 this . unsubChildren$ . next ( ) ;
503504 const toBeSelected = [ ...this . forceSelect ] ;
504- requestAnimationFrame ( ( ) => {
505+ if ( this . platform . isBrowser ) {
506+ requestAnimationFrame ( ( ) => {
507+ this . selectionService . selectNodesWithNoEvent ( toBeSelected ) ;
508+ } ) ;
509+ } else {
505510 this . selectionService . selectNodesWithNoEvent ( toBeSelected ) ;
506- } ) ;
511+ }
507512 this . forceSelect = [ ] ;
508513 this . nodes . forEach ( node => {
509514 node . expandedChange . pipe ( takeUntil ( this . unsubChildren$ ) ) . subscribe ( nodeState => {
0 commit comments