-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Add EmptyContent to Virtualize #38978
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
Conversation
/// Gets or sets the empty content. | ||
/// </summary> | ||
[Parameter] | ||
public RenderFragment? EmptyContent { get; set; } |
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.
Could you follow the instructions here: https://github.com/dotnet/aspnetcore/blob/main/docs/APIBaselines.md#publicapiunshippedtxt?
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 sir. I missed that part of the instructions.
@@ -193,6 +199,11 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) | |||
|
|||
builder.OpenRegion(3); | |||
|
|||
if (EmptyContent is not null && _itemCount == 0) |
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.
Wouldn't this show the empty content when the list is still being loaded in the event the data source is an ItemsProvider
? That doesn't seem right.
Could we also add some tests for this?
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.
You're right, it indeed does. I will rectify that and write some tests.
Co-authored-by: Pranav K <[email protected]>
Hi @alex-oswald. |
No work plans during the holidays. If you need to close this to keep it clean that’s cool. I can reopen after the holidays when I finish the work. |
No worries, it's just an automated process. Feel free to reopen whenever you're ready 😀 |
Add EmptyContent to Virtualize component
Description
This PR adds an
EmptyContent
fragment to the virtualize component. If there are no items to render, and the fragment is not null, the fragment is rendered.This is useful because as it stands, if there are no items to render, nothing is rendered, potentially leaving a user confused.
Implements: #28770