Skip to content

Commit 3073c96

Browse files
committed
fix(tree): added missing import and removed extra raf call
1 parent 197ef39 commit 3073c96

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

projects/igniteui-angular/src/lib/tree/tree.component.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { IgxTreeNodeComponent } from './tree-node/tree-node.component';
2929
import { IgxTreeSelectionService } from './tree-selection.service';
3030
import { IgxTreeService } from './tree.service';
3131
import { 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,14 +502,15 @@ export class IgxTreeComponent implements IgxTree, OnInit, AfterViewInit, OnDestr
501502
private subToChanges() {
502503
this.unsubChildren$.next();
503504
const toBeSelected = [...this.forceSelect];
504-
requestAnimationFrame(() => {
505-
this.selectionService.selectNodesWithNoEvent(toBeSelected);
506-
});
505+
507506
if(this.platform.isBrowser) {
508507
requestAnimationFrame(() => {
509508
this.selectionService.selectNodesWithNoEvent(toBeSelected);
510509
});
510+
} else {
511+
this.selectionService.selectNodesWithNoEvent(toBeSelected);
511512
}
513+
512514
this.forceSelect = [];
513515
this.nodes.forEach(node => {
514516
node.expandedChange.pipe(takeUntil(this.unsubChildren$)).subscribe(nodeState => {

0 commit comments

Comments
 (0)