File tree 2 files changed +26
-7
lines changed
2 files changed +26
-7
lines changed Original file line number Diff line number Diff line change @@ -177,11 +177,20 @@ protected override async Task ChangeHandlerAsync(ChangeEventArgs e)
177
177
178
178
public new async ValueTask DisposeAsync ( )
179
179
{
180
- if ( Module is not null && ! string . IsNullOrEmpty ( Id ) )
180
+ try
181
181
{
182
- await Module . InvokeVoidAsync ( "detachIndicatorClickHandler" , Id ) ;
183
- await Module . DisposeAsync ( ) ;
182
+ if ( Module is not null && ! string . IsNullOrEmpty ( Id ) )
183
+ {
184
+ await Module . InvokeVoidAsync ( "detachIndicatorClickHandler" , Id ) ;
185
+ await Module . DisposeAsync ( ) ;
186
+ }
187
+ await base . DisposeAsync ( ) ;
188
+ }
189
+ catch ( Exception ex ) when ( ex is JSDisconnectedException ||
190
+ ex is OperationCanceledException )
191
+ {
192
+ // The JSRuntime side may routinely be gone already if the reason we're disposing is that
193
+ // the client disconnected. This is not an error.
184
194
}
185
- await base . DisposeAsync ( ) ;
186
195
}
187
196
}
Original file line number Diff line number Diff line change @@ -266,11 +266,21 @@ private async Task OnCloseInternalHandlerAsync(MouseEventArgs e)
266
266
/// <returns></returns>
267
267
public async ValueTask DisposeAsync ( )
268
268
{
269
- await InvokeOverlayDisposeAsync ( ) ;
269
+ try
270
+ {
271
+ await InvokeOverlayDisposeAsync ( ) ;
272
+
273
+ if ( _jsModule != null )
274
+ {
275
+ await _jsModule . DisposeAsync ( ) ;
276
+ }
270
277
271
- if ( _jsModule != null )
278
+ }
279
+ catch ( Exception ex ) when ( ex is JSDisconnectedException ||
280
+ ex is OperationCanceledException )
272
281
{
273
- await _jsModule . DisposeAsync ( ) ;
282
+ // The JSRuntime side may routinely be gone already if the reason we're disposing is that
283
+ // the client disconnected. This is not an error.
274
284
}
275
285
276
286
GlobalState . OnChange -= UpdateNeutralColor ;
You can’t perform that action at this time.
0 commit comments