Skip to content

Rerendering of component with multiple classes #107

Description

@esso23

Let's say we have a component called <MasterComponent>. This component has style definitions within declared using <Styled @bind-Classname>.

When the component has a single css class defined in it, the component's OnAfterRender method is called twice, which is standard. Also the <Styled> component's OnAfterRender is called twice. This is fine.

When you have 2 css classes, each class gets rendered 3 times and <MasterComponent> OnAfterRender method is called 3 times aswell.

When you have 20 css classes, each class gets rendered 21 times (for a total of 420 renders) and the <MasterComponent>'s OnAfterRender is called 21 times too.

When I create a <ChildComponent> with 20 css classes and I render it 10 times in <MasterComponent> and I also render <MasterComponent> 10 times, I get 46200 calls to OnAfterRender on <Styled> components. That's a lot. This problem could get really bad in larger applications where you can get to millions pretty easily.

I think this is a big contributor to the performance problems in v3 mentioned here #104

To be completely honest, I have no idea why it happens. Maybe you'll understand it better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions