Skip to content

Commit 608544c

Browse files
committed
fix(forof): Do not force setting master on each change.
1 parent 84cf52f commit 608544c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1626,7 +1626,7 @@ export class IgxGridForOfDirective<T, U extends T[] = T[]> extends IgxForOfDirec
16261626
}
16271627
if (this.igxForScrollOrientation === 'horizontal') {
16281628
// in case collection has changes, reset sync service
1629-
this.syncService.setMaster(this, true);
1629+
this.syncService.setMaster(this, false);
16301630
}
16311631
}
16321632
const defaultItemSize = 'igxForItemSize';

projects/igniteui-angular/src/lib/directives/for-of/for_of.sync.service.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ export class IgxForOfSyncService {
2121
*/
2222
public setMaster(directive: IgxGridForOfDirective<any, any[]>, forced = false) {
2323
const orientation = directive.igxForScrollOrientation;
24+
// in case master is not in dom, set a new master
25+
const isMasterInDom = this._master.get(orientation)?.dc?.instance?._viewContainer.element.nativeElement.isConnected;
26+
if (!isMasterInDom) {
27+
forced = true;
28+
}
2429
if (orientation && (forced || !this._master.has(orientation))) {
2530
this._master.set(orientation, directive);
2631
}

0 commit comments

Comments
 (0)