From 608544c26a2145738f8f1d79f64aba0b30283982 Mon Sep 17 00:00:00 2001 From: Martin Dragnev Date: Tue, 11 Jun 2024 16:51:54 +0300 Subject: [PATCH 1/2] fix(forof): Do not force setting master on each change. --- .../src/lib/directives/for-of/for_of.directive.ts | 2 +- .../src/lib/directives/for-of/for_of.sync.service.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts b/projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts index 80569fff521..272b4bebbd2 100644 --- a/projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts +++ b/projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts @@ -1626,7 +1626,7 @@ export class IgxGridForOfDirective extends IgxForOfDirec } if (this.igxForScrollOrientation === 'horizontal') { // in case collection has changes, reset sync service - this.syncService.setMaster(this, true); + this.syncService.setMaster(this, false); } } const defaultItemSize = 'igxForItemSize'; diff --git a/projects/igniteui-angular/src/lib/directives/for-of/for_of.sync.service.ts b/projects/igniteui-angular/src/lib/directives/for-of/for_of.sync.service.ts index d329d437e06..9599a551e5f 100644 --- a/projects/igniteui-angular/src/lib/directives/for-of/for_of.sync.service.ts +++ b/projects/igniteui-angular/src/lib/directives/for-of/for_of.sync.service.ts @@ -21,6 +21,11 @@ export class IgxForOfSyncService { */ public setMaster(directive: IgxGridForOfDirective, forced = false) { const orientation = directive.igxForScrollOrientation; + // in case master is not in dom, set a new master + const isMasterInDom = this._master.get(orientation)?.dc?.instance?._viewContainer.element.nativeElement.isConnected; + if (!isMasterInDom) { + forced = true; + } if (orientation && (forced || !this._master.has(orientation))) { this._master.set(orientation, directive); } From 9bda69b4e83378b2e45da50a1a9d6904ede61e9a Mon Sep 17 00:00:00 2001 From: Martin Dragnev Date: Fri, 14 Jun 2024 18:14:51 +0300 Subject: [PATCH 2/2] chore(forof): Make sure if size cache is unique (pivot headers) that sync service master is correct --- .../src/lib/directives/for-of/for_of.directive.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts b/projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts index 272b4bebbd2..93c13b23fe9 100644 --- a/projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts +++ b/projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts @@ -1626,7 +1626,7 @@ export class IgxGridForOfDirective extends IgxForOfDirec } if (this.igxForScrollOrientation === 'horizontal') { // in case collection has changes, reset sync service - this.syncService.setMaster(this, false); + this.syncService.setMaster(this, this.igxGridForOfUniqueSizeCache); } } const defaultItemSize = 'igxForItemSize';