Skip to content

Commit ac78c2b

Browse files
MKirovaMKirova
authored andcommitted
fix(igxSplitter): Assign pane props after zone is stable.
1 parent 7afbf43 commit ac78c2b

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { AfterContentInit, Component, ContentChildren, ElementRef, EventEmitter, HostBinding, HostListener, Inject, Input, Output, QueryList, booleanAttribute, forwardRef, DOCUMENT } from '@angular/core';
1+
import { AfterContentInit, Component, ContentChildren, ElementRef, EventEmitter, HostBinding, HostListener, Inject, Input, NgZone, Output, QueryList, booleanAttribute, forwardRef, DOCUMENT } from '@angular/core';
22
import { DragDirection, IDragMoveEventArgs, IDragStartEventArgs, IgxDragDirective, IgxDragIgnoreDirective } from '../directives/drag-drop/drag-drop.directive';
33
import { IgxSplitterPaneComponent } from './splitter-pane/splitter-pane.component';
4+
import { take } from 'rxjs';
45

56
/**
67
* An enumeration that defines the `SplitterComponent` panes orientation.
@@ -154,7 +155,7 @@ export class IgxSplitterComponent implements AfterContentInit {
154155
*/
155156
private sibling!: IgxSplitterPaneComponent;
156157

157-
constructor(@Inject(DOCUMENT) public document, private elementRef: ElementRef) { }
158+
constructor(@Inject(DOCUMENT) public document, private elementRef: ElementRef, private zone: NgZone) { }
158159
/**
159160
* Gets/Sets the splitter orientation.
160161
*
@@ -197,7 +198,9 @@ export class IgxSplitterComponent implements AfterContentInit {
197198

198199
/** @hidden @internal */
199200
public ngAfterContentInit(): void {
200-
this.initPanes();
201+
this.zone.onStable.pipe(take(1)).subscribe(() => {
202+
this.initPanes();
203+
});
201204
this.panes.changes.subscribe(() => {
202205
this.initPanes();
203206
});
@@ -472,7 +475,7 @@ export class IgxSplitBarComponent {
472475
* @hidden @internal
473476
*/
474477
public get prevButtonHidden() {
475-
return this.siblings[0].collapsed && !this.siblings[1].collapsed;
478+
return this.siblings[0]?.collapsed && !this.siblings[1]?.collapsed;
476479
}
477480

478481
/**
@@ -559,7 +562,7 @@ export class IgxSplitBarComponent {
559562
* @hidden @internal
560563
*/
561564
public get nextButtonHidden() {
562-
return this.siblings[1].collapsed && !this.siblings[0].collapsed;
565+
return this.siblings[1]?.collapsed && !this.siblings[0]?.collapsed;
563566
}
564567

565568
/**
@@ -599,7 +602,7 @@ export class IgxSplitBarComponent {
599602

600603
protected get resizeDisallowed() {
601604
const relatedTabs = this.siblings;
602-
return !!relatedTabs.find(x => x.resizable === false || x.collapsed === true);
605+
return !!relatedTabs.find(x => x?.resizable === false || x?.collapsed === true);
603606
}
604607

605608
/**

0 commit comments

Comments
 (0)