Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit35c6d2a

Browse files
committed
fix(toaster): Unexpected state: no hydration info available for a given TNode, which represents a view container. [Expected=> null != undefined <=Actual] - ensure that the contentToasts is available before accessing it - tempfix
1 parente6e04d2 commit35c6d2a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<ng-templatecToasterHost/>
2-
<ng-contentcToasterHost/>
2+
<ng-content/>

‎projects/coreui-angular/src/lib/toast/toaster/toaster.component.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
computed,
55
contentChildren,
66
DestroyRef,
7+
effect,
78
ElementRef,
89
inject,
910
Injector,
@@ -84,6 +85,12 @@ export class ToasterComponent implements OnInit {
8485
readonlytoasterHost=viewChild.required(ToasterHostDirective);
8586
readonlycontentToasts=contentChildren(ToastComponent,{read:ViewContainerRef});
8687

88+
readonly #contentToastsEffect=effect(()=>{
89+
// Ensure that the contentToasts is available before accessing it
90+
// temp fix for: ASSERTION ERROR: Unexpected state: no hydration info available for a given TNode, which represents a view container. [Expected=> null != undefined <=Actual]
91+
this.contentToasts();
92+
});
93+
8794
readonlyhostClasses=computed(()=>{
8895
constplacement=this.placement;
8996
constposition=this.position();
@@ -143,7 +150,7 @@ export class ToasterComponent implements OnInit {
143150
this.contentToasts()?.forEach((item)=>{
144151
if(state.toast&&item.element.nativeElement===state.toast.hostElement.nativeElement){
145152
if(!state.toast.dynamic()){
146-
state.toast['visible']=false;
153+
state.toast.visible=false;
147154
}
148155
}
149156
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp