-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(component): add suspense template input to LetDirective #3377
feat(component): add suspense template input to LetDirective #3377
Conversation
✅ Deploy Preview for ngrx-io ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
static ngTemplateContextGuard<U>( | ||
dir: LetDirective<U>, | ||
ctx: unknown | null | undefined | ||
): ctx is LetViewContext<U> { | ||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved because of the @typescript-eslint/member-ordering
rule
* The `*ngrxLet` directive serves a convenient way of binding observables to a view context (a dom element scope). | ||
* It also helps with several internal processing under the hood. | ||
* | ||
* The current way of binding an observable to the view looks like that: | ||
* ```html | ||
* <ng-container *ngIf="observableNumber$ | async as n"> | ||
* <app-number [number]="n"> | ||
* </app-number> | ||
* <app-number-special [number]="n"> | ||
* </app-number-special> | ||
* </ng-container> | ||
* ``` | ||
* | ||
* The problem is `*ngIf` is also interfering with rendering and in case of a `0` the component would be hidden | ||
* | ||
* Included Features: | ||
* - binding is always present. (`*ngIf="truthy$ | async"`) | ||
* - it takes away the multiple usages of the `async` or `ngrxPush` pipe | ||
* - a unified/structured way of handling null and undefined | ||
* - triggers change-detection differently if `zone.js` is present or not (`ChangeDetectorRef.detectChanges` or `ChangeDetectorRef.markForCheck`) | ||
* - triggers change-detection differently if ViewEngine or Ivy is present (`ChangeDetectorRef.detectChanges` or `ɵdetectChanges`) | ||
* - distinct same values in a row (distinctUntilChanged operator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed duplicated content that is also in the let.md
file. I have left a short description and examples here.
fd57c30
to
4a47bf5
Compare
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Closes #3340
What is the new behavior?
Added ability to pass the suspense template to
LetDirective
:A suspense template will be displayed when passed observable is in a suspense state. If the suspense template is not passed, the behavior will remain the same:
undefined
. However, there is new view context property$suspense
that can be used in this case:Does this PR introduce a breaking change?