Skip to content

[Blazor] Add a way to indicate event handler should not call StateHasChanged  #22236

Closed
@mrpmorris

Description

@mrpmorris

When adding @onmousemove=MouseHasMoved to an element Blazor will re-render the component every time the MouseHasMoved method finishes executing.

Preventing this using ShouldRender is tricky, because the component might need to render for other reasons, and having to set some state for every scenario that causes a re-render is labourious.

Could we have a way of telling Blazor not to add a call to StateHasChanged. Perhaps something like this

@onmousemove:preventStateHasChanged
@onmousemove:preventStateHasChanged=true
@onmousemove:preventStateHasChanged=LeftMouseButtonIsHeldDown

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions