question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Simplified Blazor Component Model to reduce overhead in lists

See original GitHub issue

I would love to see a simplified Blazor Component Model that is just basically a RenderFragment. I have a few lists where each row of the list is a set of components. These are basic components just so I don’t have to have 10 lines of html code for each column. These lists when done with components get really slow really fast. (25 - 50 rows and it almost becomes unusable). To work around this I use RenderFragments and it works well and makes it speedy again. However, I then lose the nice readability of using a custom tag for each item. Instead I find myself injecting code within my razor component page.

// This just returns a RenderFragment @MyComponent.RenderComponent(new MyComponentOptions() { Param1=“some `Parameter”, Param2=“some Parameter”, Param3=“some Parameter”, })

instead of: // Can not use simple components that just basically render html because they make the application way too slow <MyComponent Param1=“some Parameter”, Param2=“some Parameter”, Param3=“some Parameter” ></MyComponent>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
neufel42commented, Feb 15, 2021

Our large dom object was basically a list within a list. Within our list we had a dropdown that was not being shown via css. We refactored our code to not render this dropdown until we needed it and the list sped up exponentially.

We had several of dropdowns in the list making is really slow really fast. This was programming error

<MyLineItem></MyLineItem>

MyLineItem.razor
    <ListOfItems />  

MyLineItem.razor (revised psudo code to speed up component)
    @if(ClickedMyLineItem) //Adding an if in the line item sped up my component exponentially
    {
         <ListOfItems />  
    }

Hope my psudo code above makes sense but that is basically all we did to speed things up and kept our functionality

0reactions
ChristianWeyercommented, Feb 15, 2021

Can you maybe explain what “a large ‘hidden’ dom component” exactly is? Do you care to share some details so that others will not run into the same situation? 😉 Thanks @neufel42

Read more comments on GitHub >

github_iconTop Results From Across the Web

ASP.NET Core Blazor performance best practices
When a Blazor WebAssembly app is published, the output is statically compressed during publish to reduce the app's size and remove the overhead...
Read more >
Displaying Lists Efficiently in Blazor
Blazor's Virtualize component will let you display long lists faster without writing a lot of code. If you want to take full advantage...
Read more >
10 Blazor Features You Probably Didn't Know
Blazor is a cutting-edge framework for web development with .NET. In this blog, we'll explain the most important features you need to know ......
Read more >
A New Era of Productivity with Blazor
Blazor is a new Web framework that uses .NET Core's architecture, essentially combining the simplicity of Razor with .NET Core concepts. Ed shows...
Read more >
Blazor WebAssembly & Web API on .NET 6 – Full Course (C#)
Learn Blazor WebAssembly and Web API on .NET 6 by building a shopping cart application using C#. This course also provides a guide...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found