OnAfterRender being called after every scrolling via javascript
See original GitHub issueI am initiating a scroll to a specific element from OnAfterRender
override. I am scrolling in multiple steps to animate the scroll but I am noticing that after each step of scrolling is complete, OnAfterRender
is getting called. Is this expected?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Blazor OnAfterRenderAsync Javascript
So I've been playing around with Blazor WebAssembly and I can't figure out how to solve this problem. Basically, I have a NavMenu.razor...
Read more >How to run code after Blazor component has rendered
This blog post will show you how to run code after your Blazor component has rendered, on every render or as needed.
Read more >onAfterRender not called after grid scrolling - ZK Forum
One solution seems to be calling grid.renderAll() [2], for example in doAfterCompose. That way the wireEvents finds all the rows. Is there any...
Read more >Call JavaScript functions from .NET methods in ASP. ...
This article explains how to invoke JavaScript (JS) functions from .NET. For information on how to call .NET methods from JS, see Call...
Read more >What are the application lifecycle methods in Blazor?
OnAfterRenderAsync (bool firstRender). This is the asynchronous method which is executed when the rendering of all the references to the component are ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
What event are you talking about? I did not register for any event. I am just invoking
element.scrollTo
fromOnAfterRender
override of my component via JS interop. AndOnAfterRender
is getting called after that scrolling is complete. I don’t think blazor is re-rendering. I will see if I can provide a simple project to reproduce the issue.That is an ugly work around. I hoped for a solution like adding
@on{EVENT}:disableRerender="true"
to prevent re-render.I think I will go the route of a custom base class implementing
IComponent
andIHandleEvent
interface to permanently disable the call toStateHasChanged
on handling any events. (along with other related interfaces).