Skip to content
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

Implemented RadzenAsyncLoader component for Blazor, providing asynchronous data loading #1502

Closed
wants to merge 2 commits into from

Conversation

itsalfredakku
Copy link

With optional loading and data templates. Resembles the functionality of Flutter's FutureBuilder component.

…onous data loading with optional loading and data templates. Resembles the functionality of Flutter's FutureBuilder component.
@enchev
Copy link
Collaborator

enchev commented May 13, 2024

Thanks for the pull request @itsalfredakku! Please add an example in the demos in order to know how this component can be used.

@itsalfredakku
Copy link
Author

AsyncLoader component

This article demonstrates how to use the AsyncLoader component.

Loading data asynchronously

The AsyncLoader component enables loading data asynchronously in Blazor applications. It offers the flexibility to specify loading and loaded templates, handle errors during data retrieval, and update the UI accordingly.

<RadzenAsyncLoader TData="Server.Models.ApplicationUser" DataTask="@Security.GetUserById(context.Id)">
    <LoadingTemplate>
        <RadzenProgressBarCircular ProgressBarStyle="ProgressBarStyle.Primary" Value="100" ShowValue="false" Mode="ProgressBarMode.Indeterminate" Size="ProgressBarCircularSize.Small" />
    </LoadingTemplate>
    <Template Context="ctx">
        <RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" Gap="0.5rem">
            @foreach (var role in ctx.Roles)
            {
                <RadzenBadge Text="@role.Name" />
            }
        </RadzenStack>
    </Template>
</RadzenAsyncLoader>

@itsalfredakku
Copy link
Author

The code has been refactored and we are now attempting to integrate it into the demonstration examples as well.

@akorchev
Copy link
Collaborator

akorchev commented May 13, 2024

What is the purpose of TData here? It is usually used for data-bound components - ones that have "items" and the template is repeated for each item. Is it only to get the result out of the DataTask? What if I just want to use Task (the non-generic version)? Or ValueTask?

Another issue I see is that the loading content can be shown only once with the current implementation. This is one of the first things people are going to ask for - show the loading content multiple times. I just feel the API should be different - maybe a single bool IsLoading parameter which the user can set accordingly.

@enchev enchev closed this May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants