Have a BSDropdown in a form with conditional rendering (e.g. wrapped in an @if linked to a checkbox).
Open the dropdown at least once.
Cause the dropdown to be disposed (e.g. uncheck the checkbox).
Click anywhere on the page.
In the JS Console, the following error is logged:
Uncaught (in promise) Error: System.ArgumentException: There is no tracked object with id '7'. Perhaps the DotNetObjectReference instance was already disposed. (Parameter 'dotNetObjectId')
It's looking like BSDropdown.ShowActionsAsync is registering a document click event using the dropdown's reference, and then the DisposeAsync is attempting to remove it, although it appears that this is failing to actually do so. I have not investigated why.
I have confirmed that the error is not logged if I set AllowOutsideClick="true", which avoids registering the event in the first place.
I've also confirmed that InteropEventCallback still gets called after opening and closing the dropdown and then clicking on the background, despite the attempt to unregister it in HideActionsAsync.
(Side note: the dispose is also doing things in the wrong order -- it should unregister all events that might possibly call it before disposing the object reference, although that is not the actual problem here.)
BSDropdown
in a form with conditional rendering (e.g. wrapped in an@if
linked to a checkbox).In the JS Console, the following error is logged:
It's looking like
BSDropdown.ShowActionsAsync
is registering a document click event using the dropdown's reference, and then theDisposeAsync
is attempting to remove it, although it appears that this is failing to actually do so. I have not investigated why.I have confirmed that the error is not logged if I set
AllowOutsideClick="true"
, which avoids registering the event in the first place.I've also confirmed that
InteropEventCallback
still gets called after opening and closing the dropdown and then clicking on the background, despite the attempt to unregister it inHideActionsAsync
.(Side note: the dispose is also doing things in the wrong order -- it should unregister all events that might possibly call it before disposing the object reference, although that is not the actual problem here.)