Skip to content

Commit 404c3b2

Browse files
lexasqAlex Umanskiyclaude
authored
fix(component-loader): prevent popover context text flash in zoneless… (#6817)
* fix(component-loader): prevent popover context text flash in zoneless mode In zoneless mode, popover content rendered with popoverContext briefly flashed at the trigger element location before being positioned in the popup. Hide the element until the first positioning pass completes, and pass the provided context to createEmbeddedView so the content renders correctly. Fixes #6811 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: bump version to 21.2.1 --------- Co-authored-by: Alex Umanskiy <aleksey.umanskiy@valor-software.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 75cef79 commit 404c3b2

31 files changed

Lines changed: 49 additions & 32 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "21.2.0"
2+
"version": "21.2.1"
33
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-bootstrap-base",
3-
"version": "21.2.0",
3+
"version": "21.2.1",
44
"license": "MIT",
55
"author": "Dmitriy Shekhovtsov <valorkin@gmail.com>",
66
"schematics": "./schematics/src/collection.json",

src/accordion/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-bootstrap/accordion",
3-
"version": "21.2.0",
3+
"version": "21.2.1",
44
"author": "Dmitriy Shekhovtsov <valorkin@gmail.com>",
55
"license": "MIT"
66
}

src/alert/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-bootstrap/alert",
3-
"version": "21.2.0",
3+
"version": "21.2.1",
44
"author": "Dmitriy Shekhovtsov <valorkin@gmail.com>",
55
"license": "MIT"
66
}

src/buttons/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-bootstrap/buttons",
3-
"version": "21.2.0",
3+
"version": "21.2.1",
44
"author": "Dmitriy Shekhovtsov <valorkin@gmail.com>",
55
"license": "MIT"
66
}

src/carousel/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-bootstrap/carousel",
3-
"version": "21.2.0",
3+
"version": "21.2.1",
44
"author": "Dmitriy Shekhovtsov <valorkin@gmail.com>",
55
"license": "MIT"
66
}

src/chronos/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-bootstrap/chronos",
3-
"version": "21.2.0",
3+
"version": "21.2.1",
44
"author": "Dmitriy Shekhovtsov <valorkin@gmail.com>",
55
"license": "MIT"
66
}

src/collapse/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-bootstrap/collapse",
3-
"version": "21.2.0",
3+
"version": "21.2.1",
44
"author": "Dmitriy Shekhovtsov <valorkin@gmail.com>",
55
"license": "MIT"
66
}

src/component-loader/component-loader.class.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ export class ComponentLoader<T extends object> {
187187
);
188188
}
189189

190+
// Hide element initially when positioning is active to prevent flash in zoneless mode
191+
if (this.attachment) {
192+
this._componentRef.location.nativeElement.style.visibility = 'hidden';
193+
}
194+
190195
// we need to manually invoke change detection since events registered
191196
// via
192197
// Renderer::listen() are not picked up by change detection with the
@@ -368,12 +373,24 @@ export class ComponentLoader<T extends object> {
368373

369374
// Use requestAnimationFrame for zoneless-compatible position updates
370375
// This replaces the previous NgZone.onStable subscription
376+
let isFirstPositioning = true;
371377
const schedulePositioning = () => {
372378
if (!this._componentRef) {
373379
return;
374380
}
375381

376382
this._posService.calcPosition();
383+
384+
// Show popover after first positioning is complete to prevent flash
385+
if (isFirstPositioning) {
386+
isFirstPositioning = false;
387+
requestAnimationFrame(() => {
388+
if (this._componentRef?.location) {
389+
this._componentRef.location.nativeElement.style.visibility = 'visible';
390+
}
391+
});
392+
}
393+
377394
this._positioningRafId = requestAnimationFrame(schedulePositioning);
378395
};
379396

@@ -408,7 +425,7 @@ export class ComponentLoader<T extends object> {
408425

409426
return new ContentRef([_viewRef.rootNodes], _viewRef);
410427
}
411-
const viewRef = content.createEmbeddedView({});
428+
const viewRef = content.createEmbeddedView(context || {});
412429
this._applicationRef.attachView(viewRef);
413430

414431
return new ContentRef([viewRef.rootNodes], viewRef);

0 commit comments

Comments
 (0)