Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit df9b2c1

Browse files
committed
refactor(template): rxChunk: make sure suspense template isn't created with sync strategies
1 parent 8dcc59b commit df9b2c1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

libs/template/chunk/src/lib/chunk.directive.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,6 @@ export class ChunkDirective implements OnInit, OnDestroy {
143143
) {}
144144

145145
ngOnInit() {
146-
if (this.suspense) {
147-
this.createView(this.suspense);
148-
}
149146
this.subscription = this.strategyProvider
150147
.schedule(
151148
() => {
@@ -159,6 +156,11 @@ export class ChunkDirective implements OnInit, OnDestroy {
159156
}
160157
)
161158
.subscribe(() => this._renderObserver?.next());
159+
// do not create suspense template when strategy was sync and there already
160+
// is a template
161+
if (this.suspense && this.viewContainer.length === 0) {
162+
this.createView(this.suspense);
163+
}
162164
}
163165

164166
ngOnDestroy() {

0 commit comments

Comments
 (0)