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

EnC Razor scenario: allow adding new lambda closures #67841

Closed
tmat opened this issue Apr 17, 2023 · 1 comment · Fixed by #70418
Closed

EnC Razor scenario: allow adding new lambda closures #67841

tmat opened this issue Apr 17, 2023 · 1 comment · Fixed by #70418

Comments

@tmat
Copy link
Member

tmat commented Apr 17, 2023

MudBlazor uses the following pattern:

__builder.AddAttribute(
    8,
    "RowTemplate",
    new Microsoft.AspNetCore.Components.RenderFragment<string>(
         (context) => (__builder2) => { __builder2.AddContent(9, context); }));

Repro:

Create MAUI Blazor app.

Add to Index.razor:

@code{
    private List<string> _certificates = new List<string>() { "a", "b", "c" };
}

Ctrl+F5, add following and Hot Reload:

<MudTable T="string" Items="_certificates" Class="rounded-0" Hover="true">
    <RowTemplate>@context</RowTemplate>
</MudTable>
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Interactive untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 17, 2023
@danroth27
Copy link
Member

Render fragments in Blazor are used for a couple of common use cases where a component needs to capture some Razor content that is passed as a parameter to the component and then rendered by the component:

Render fragments can also be used to define reusable chunks of Razor logic, but this is less common.

@SteveSandersonMS @javiercn @MackinnonBuck We should work with @tmat to understand if there's anything we can do to evolve our API to make this scenario more hot reload friendly.

@arkalyanms arkalyanms removed the untriaged Issues and PRs which have not yet been triaged by a lead label Aug 3, 2023
@tmat tmat modified the milestones: 17.9 P2, 17.9 P3 Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants