Skip to content

Commit 4739672

Browse files
Copilotdamyanpetev
andcommitted
fix(elements-grid): emit childrenAttached after component is fully initialized
Agent-Logs-Url: https://github.com/IgniteUI/igniteui-angular/sessions/8468a815-5933-4d6a-8967-da503ef2bdd5 Co-authored-by: damyanpetev <3198469+damyanpetev@users.noreply.github.com>
1 parent 3851f04 commit 4739672

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

projects/igniteui-angular-elements/src/app/custom-strategy.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,6 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy {
167167
// TODO(D.P.): Temporary maintain pre-check for ngAfterViewInit handling on _init flag w/ ngDoCheck interaction of row island
168168
(this as any).componentRef.changeDetectorRef.detectChanges();
169169

170-
// check if there are any content children associated with a content query collection.
171-
// if no, then just emit the event, otherwise we wait for the collection to be updated in updateQuery.
172-
const contentChildrenTypes = this.config.filter(x => contentChildrenTags.indexOf(x.selector) !== -1).map(x => x.provideAs ?? x.component);
173-
const contentQueryChildrenCollection = componentConfig.contentQueries.filter(x => contentChildrenTypes.includes(x.childType));
174-
if (contentQueryChildrenCollection.length === 0) {
175-
// no content children, emit event immediately, since there's nothing to be attached.
176-
(this as any).componentRef?.instance?.childrenAttached?.emit();
177-
}
178-
179170
if (parentAnchor && parentInjector) {
180171
// attempt to attach the newly created ViewRef to the parents's instead of the App global
181172
const parentViewRef = parentInjector.get<ViewContainerRef>(ViewContainerRef);
@@ -218,6 +209,15 @@ class IgxCustomNgElementStrategy extends ComponentNgElementStrategy {
218209
this.patchGridPopups();
219210
}
220211

212+
// check if there are any content children associated with a content query collection.
213+
// if no, then just emit the event, otherwise we wait for the collection to be updated in updateQuery.
214+
const contentChildrenTypes = this.config.filter(x => contentChildrenTags.indexOf(x.selector) !== -1).map(x => x.provideAs ?? x.component);
215+
const contentQueryChildrenCollection = componentConfig?.contentQueries?.filter(x => contentChildrenTypes.includes(x.childType));
216+
if (!contentQueryChildrenCollection?.length) {
217+
// no content children that will trigger query updates, emit event immediately.
218+
(this as any).componentRef?.instance?.childrenAttached?.emit();
219+
}
220+
221221
// instead of duplicating super.disconnect() w/ the scheduled destroy:
222222
componentRef.onDestroy(() => {
223223
if (this._templateWrapperRef) {

0 commit comments

Comments
 (0)