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

[Blazor] API for interpreting RenderFragment contents. #17200

Open
javiercn opened this issue Nov 18, 2019 · 8 comments
Open

[Blazor] API for interpreting RenderFragment contents. #17200

javiercn opened this issue Nov 18, 2019 · 8 comments
Labels
affected-few This issue impacts only small number of customers area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-blazor-component-model Any feature that affects the component model for Blazor (Parameters, Rendering, Lifecycle, etc) feature-rendering Features dealing with how blazor renders components Priority:2 Work that is important, but not critical for the release severity-blocking This label is used by an internal tool
Milestone

Comments

@javiercn
Copy link
Member

The idea is to allow interpreting a render fragment so that it can be transformed to change it before applying it.

@javiercn javiercn added area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one labels Nov 18, 2019
@javiercn javiercn added this to the Backlog milestone Nov 18, 2019
@mrpmorris
Copy link

Cos you give a mock-up example of this, please! Thanks @javiercn

@Postlagerkarte
Copy link

Postlagerkarte commented Nov 19, 2019

Great! For what it is worth here are two more supporting issues for this:

#9493
#16737

@javiercn javiercn added affected-few This issue impacts only small number of customers severity-blocking This label is used by an internal tool labels Oct 9, 2020 — with ASP.NET Core Issue Ranking
@mrlife
Copy link
Contributor

mrlife commented Feb 2, 2021

Related: #29648

@javiercn javiercn added feature-blazor-component-model Any feature that affects the component model for Blazor (Parameters, Rendering, Lifecycle, etc) feature-rendering Features dealing with how blazor renders components labels Apr 19, 2021
@tstockwell
Copy link

The idea is to allow interpreting a render fragment so that it can be transformed to change it before applying it.

Seems like this would be possible right now...


// the original render fragment
void OriginalRenderFragment(RenderTreeBuillder builder) {
      // some rendering logic here
}

// a new render fragment that applies customizations to the output from OriginalRenderFragment
void RenderWithTransformations(RenderTreeBuillder builder) {
      var builder1= new RenderTreeBuilder();
      OriginalRenderFragment(builder1);
      var frames1= builder1.GetFrames();
      
      var frames2= ApplyMyTransformations(frames1);   
      RenderFrames(builder, frames2); 
}

// applies some transformations to an array of frames and returns a new array
ArrayRange<RenderTreeFrame> ApplyMyTransformations(ArrayRange<RenderTreeFrame> frames) {
       .....
}

// simply renders the given frames to a RenderTreeBuilder
void RenderFrames(RenderTreeBuilder builder, ArrayRange<RenderTreeFrame> frames) {
    ....
}

I'm aware that frames belong to an internal package, that's not a showstopping problem for me, but it would be nice if Blazor had a legit API that let me do something equivalent to this.

@Hecatron
Copy link

I recently ran into this problem with - #36976
One question is if there is a way to add an existing frame to a builder, since I didn't see an API for that
with the above this would be the part within RenderFrames

The way I've fudged it myself so far is to

// Add a dummy entry to the destination array in the builder, this increments the count
destbuilder.AddMarkupContent(i, "");

// Do a direct assign to the array to overwrite the struct.
var destframes = destbuilder.GetFrames();
destframes.Array[i] = srcframes.Array[i];

I'm sure this isn't right but for now it does work. Ideally we need an API for copying / assigning an existing frame from a different Array of frames.

@TanayParikh TanayParikh modified the milestones: Backlog, .NET 7 Planning Oct 19, 2021
@TanayParikh TanayParikh added the Priority:2 Work that is important, but not critical for the release label Oct 21, 2021
@ghost
Copy link

ghost commented Oct 28, 2021

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@mkArtakMSFT mkArtakMSFT added this to the Backlog milestone Jun 29, 2023
@ghost
Copy link

ghost commented Jun 29, 2023

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@macias
Copy link

macias commented Sep 17, 2024

I can see this ticket is swallowing others, and from developer perspective it is a problem, because I fear the scope of this particular issue is so grand it will take more years to accomplish (and this is not set in stone it will ever be). And the swallowed posts are more focused, and I believe more probable to support right now. I am pointing at supporting collection of RenderFragment (currently there are workarounds for it, but AFAIK not proper solutions).

So writing this from 2024 perspective, 5 years passed and there is still no basic collection support because it could not be done in this time no matter what, or there is no support because we keep aiming higher and this is what kills collection support? If it the latter case, IMHO it would be much better to split those issues and allow a separate ticket for collection support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affected-few This issue impacts only small number of customers area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-blazor-component-model Any feature that affects the component model for Blazor (Parameters, Rendering, Lifecycle, etc) feature-rendering Features dealing with how blazor renders components Priority:2 Work that is important, but not critical for the release severity-blocking This label is used by an internal tool
Projects
None yet
Development

No branches or pull requests