-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(component): clear
LetDirective
view when replaced observable i…
…s in suspense state (#3671) BREAKING CHANGES: The `LetDirective` view will be cleared when the replaced observable is in a suspense state. Also, the `suspense` property is removed from the `LetViewContext` because it would always be `false` when the `LetDirective` view is rendered. Instead of `suspense` property, use the suspense template to handle the suspense state. BEFORE: The `LetDirective` view will not be cleared when the replaced observable is in a suspense state and the suspense template is not passed: ```ts @component({ template: ` <!-- When button is clicked, the 'LetDirective' view won't be cleared. --> <!-- Instead, the value of 'o' will be 'undefined' until the replaced --> <!-- observable emits the first value (after 1 second). --> <p *ngrxLet="obs$ as o">{{ o }}</p> <button (click)="replaceObs()">Replace Observable</button> ` }) export class TestComponent { obs$ = of(1); replaceObs(): void { this.obs$ = of(2).pipe(delay(1000)); } } ``` AFTER: The `LetDirective` view will be cleared when the replaced observable is in a suspense state and the suspense template is not passed: ```ts @component({ template: ` <!-- When button is clicked, the 'LetDirective' view will be cleared. --> <!-- The view will be created again when the replaced observable --> <!-- emits the first value (after 1 second). --> <p *ngrxLet="obs$ as o">{{ o }}</p> <button (click)="replaceObs()">Replace Observable</button> ` }) export class TestComponent { obs$ = of(1); replaceObs(): void { this.obs$ = of(2).pipe(delay(1000)); } } ```
- Loading branch information
1 parent
bdd4471
commit ec59c4b
Showing
3 changed files
with
59 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters