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

[Question] Get the reason wich cause a component re-render - too many OnAfterRender #14684

Closed
julienGrd opened this issue Oct 2, 2019 · 2 comments
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly question
Milestone

Comments

@julienGrd
Copy link

Hi guys, i faced actually a big performance issue with my app built in blazor.

I precise my app can run in server and client mode and the performance issue is only in client mode (web assembly)

I have a view with a component which containing a large table with grouping functionnalty things like that.

I have some action outside this component which can recharge the grid.

On some actions, i freeze the app during 40 seconds, so i put some console.Writeline to see what's happen

I will not put all details of the logs but the things is it seem my component is rendered 9 times, on interval of 3 or 4 seconds approximatively (so i retrieve my 40 seconds off freeze).

One is justified, is when my component itself recharge when he see data changed (i put a log inside this place too, it called only one time).

I put a log in the OnParameterSet => this event is not called and its logic

I centralise all my StateHasChanged of all my components in a central method. These method is called only one time, on the handler when my data changed. On this place it seem Ok too.

So i have finally 8 OnAfterRender completely mysterious and it's huge problem for me to not understand from where they come from.

Unfortunately i can't reproduce the problem, my app is really big and complex, she use external code (existing silverlight ViewModel) and external services (existing Wcf services), so i have to debug by myself, that's why i need information.

So if you have idea on how i can "retrieve" the origin of theses render let me know !

Thanks for your help !

Julien

@pranavkm pranavkm added the area-blazor Includes: Blazor, Razor Components label Oct 2, 2019
@mkArtakMSFT mkArtakMSFT added the feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly label Oct 3, 2019
@mkArtakMSFT
Copy link
Member

Thanks for contacting us, @julienGrd.
You can try to override the protected bool void ShouldRender() method and add a breakpoint in there.
And then look into the call-stack to understand where from it's being called.

@mkArtakMSFT mkArtakMSFT added this to the Discussions milestone Oct 3, 2019
@julienGrd
Copy link
Author

@mkArtakMSFT yes it help me a lot thank you ! I find the guilty, it seem provide from this extension : https://github.com/mikoskinen/Blazor.EventAggregator/. Each publish seem re-render all the components wich suscribe (event with different class parameter).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly question
Projects
None yet
Development

No branches or pull requests

3 participants