Skip to content
This repository was archived by the owner on Dec 26, 2025. It is now read-only.
This repository was archived by the owner on Dec 26, 2025. It is now read-only.

[Bug] Should unsubscribe event handlers #603

Description

@Jimmys20

Event handlers in BlazoredModal are never unsubscribed. Should probably be done in DisposeAsync.

((ModalService)CascadedModalService).OnModalInstanceAdded += Update;
((ModalService)CascadedModalService).OnModalCloseRequested += CloseInstance;
NavigationManager.LocationChanged += CancelModals;
async ValueTask IAsyncDisposable.DisposeAsync()
{
    ((ModalService)CascadedModalService).OnModalInstanceAdded -= Update;
    ((ModalService)CascadedModalService).OnModalCloseRequested -= CloseInstance;
    NavigationManager.LocationChanged -= CancelModals;

    ...
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingTriageIssue needs to be triaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions