Skip to content

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

Closed
wants to merge 2 commits into from

Conversation

alex-oswald
Copy link

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

@alex-oswald alex-oswald requested a review from a team as a code owner December 12, 2021 22:48
@ghost ghost added area-blazor Includes: Blazor, Razor Components community-contribution Indicates that the PR has been added by a community member labels Dec 12, 2021
/// Gets or sets the empty content.
/// </summary>
[Parameter]
public RenderFragment? EmptyContent { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

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)
Copy link
Contributor

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?

Copy link
Author

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.

@pranavkm pranavkm added the pr: pending author input For automation. Specifically separate from Needs: Author Feedback label Dec 13, 2021
@ghost
Copy link

ghost commented Dec 23, 2021

Hi @alex-oswald.
It seems you haven't touched this PR for the last two weeks. To avoid accumulating old PRs, we're marking it as stale. As a result, it will be closed if no further activity occurs within 4 days of this comment. You can learn more about our Issue Management Policies here.

@ghost ghost added the stale Indicates a stale issue. These issues will be closed automatically soon. label Dec 23, 2021
@ghost
Copy link

ghost commented Dec 23, 2021

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.

@TanayParikh
Copy link
Contributor

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 😀

@ghost ghost closed this Dec 28, 2021
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components community-contribution Indicates that the PR has been added by a community member pr: pending author input For automation. Specifically separate from Needs: Author Feedback stale Indicates a stale issue. These issues will be closed automatically soon.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants