-
-
Notifications
You must be signed in to change notification settings - Fork 204
feat(template): introduce rxChunk #1380
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
base: main
Are you sure you want to change the base?
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit b3c6d22. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
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.
Hi @hoebbelsB really like the idea. Looks super interesting!
* @param {NextObserver<void>} renderCallback | ||
*/ | ||
@Input('rxChunkRenderCallback') | ||
set renderCallback(renderCallback: NextObserver<void>) { |
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.
Is it possible to use not only subjects but also just a function? I know it's more like a general question for render callbacks but would it worth the try?
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.
I like the idea, I would even more like to just have an @Output
. But it looks like it's not supported, at least for the *
syntax. angular/angular#12121
* | ||
* @param { RxStrategyNames<string> } strategy | ||
*/ | ||
@Input('rxChunk') strategy = this.strategyProvider.primaryStrategy; |
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.
Is it planned to work with not concurrent strategies?
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.
sure, but why would u? it basically makes the rxChunk
do nothing useful anymore :D
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.
Yes, that's the thing. Can we type this input to RxConcurrentStrategyNames?
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.
We have to support all Strategien. Other strategies then concurrent will have an effect definitely. U could e.g. use 'noop' strategy when out of viewport
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.
There is a need to support all strategies. If you want to change the rendering strategy conditionally, then this is necessary.
And it makes sense in many cases to switch the strategies based on conditions like first render and other things which may affect CLS
@hoebbelsB shouldn't we wait for the first stable release before introducing new elements? |
As not all strategies chunk let's call it rxTemplate? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1380 +/- ##
==========================================
+ Coverage 82.40% 85.14% +2.74%
==========================================
Files 107 20 -87
Lines 2251 404 -1847
Branches 393 56 -337
==========================================
- Hits 1855 344 -1511
+ Misses 333 34 -299
+ Partials 63 26 -37
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Hi, the current workaround for this is to do *rxLet="[]" Which from anyone who is not aware of the pattern makes 0 sense. Is there anything blocking the issue? Is it only the name that's blocking?
|
@Karnaukhov-kh @hoebbelsB Everything is looking solid :) *rxChunk is best name in my opinion - referring to Christopher last comment. That feature have a great marketing potential, to be announced or either be shown in a blog post. |
@Karnaukhov-kh @hoebbelsB @AdrianRomanski Just noticed that this MR has been open since before standalone 😂 I would be happy to clean that up but i guess its kind of clear that there is not plans to merge this? |
b3c6d22
to
abf550a
Compare
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 28e3c1e. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 3 targetsSent with 💌 from NxCloud. |
97bbe4d
to
d8fdf08
Compare
* | ||
* @param { boolean } patchZone | ||
*/ | ||
@Input('rxChunkPatchZone') patchZone = |
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.
Do we still want this one to be at input level, instead of having it at the provider level?
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.
well, it's anyway on provider level. I guess we can get rid of it
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.
we could get rid of it, yeah
7244611
to
7045d63
Compare
RxChunk is a shortcut for `*rxLet="[]"`. It also has the ability render a suspense view as long the actual view isn't rendered yet.
7045d63
to
28e3c1e
Compare
ChunkDirective
This PR introduces the
*rxChunk
structural directive.the
*rxChunk
directive serves as a convenient way for dividing template work into chunks.Applied to an element, it will schedule a task with the given RxRenderStrategy in order to postpone the template creation of this element.
closes #1802
PR Checklist
Features of
*rxChunk
*rxLet="[]"