dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.34k stars 9.98k forks source link

Blazor: Component re-renders even when onmousemove is null #18118

Open mrpmorris opened 4 years ago

mrpmorris commented 4 years ago

Blazor components send a message to the server about mouse-move events even though the @onmousemove event callback has been set to null.

It would be useful if, when building the render tree, Blazor wouldn't include events that are null.

Take this example. Modify the SurveyPrompt in a default template.

<div class="alert alert-secondary mt-4" role="alert" @onmousemove=OnMouseMove>
 ...Omitted for brevity
</div>

@code {
  ..Omitted

  private Action<MouseEventArgs> OnMouseMove { get; set; } = null;

  protected override void OnAfterRender(bool firstRender)
  {
      base.OnAfterRender(firstRender);
      System.Diagnostics.Debug.WriteLine("Rendered SurveyPrompt: " + (OnMouseMove == null));
  }
}

Because OnMouseMove is null the component doesn't need to re-render every time the mouse moves over it.

This would be useful for components that implement events that the consumer can optionally set.

mkArtakMSFT commented 4 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to happen for the coming release. We will reassess the backlog following the current release and consider this item at that time. However, keep in mind that there are many other high priority features with which it will be competing for resources.

ghost commented 2 years ago

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.

ghost commented 10 months ago

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.