diff --git a/src/components/BootstrapBlazor.DockView/BootstrapBlazor.DockView.csproj b/src/components/BootstrapBlazor.DockView/BootstrapBlazor.DockView.csproj index 183af799..a1f17289 100644 --- a/src/components/BootstrapBlazor.DockView/BootstrapBlazor.DockView.csproj +++ b/src/components/BootstrapBlazor.DockView/BootstrapBlazor.DockView.csproj @@ -1,7 +1,7 @@  - 10.0.22 + 10.0.23 diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor.cs b/src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor.cs index 7168a553..9c9c9c50 100644 --- a/src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor.cs +++ b/src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor.cs @@ -179,6 +179,7 @@ public partial class DockViewV2 private DockViewOptions? _options = null; private ConcurrentDictionary _componentStates = new(); private string? _layoutConfig; + private bool _disposed; /// /// @@ -215,6 +216,11 @@ protected override async Task OnAfterRenderAsync(bool firstRender) { await base.OnAfterRenderAsync(firstRender); + if (_disposed) + { + return; + } + if (firstRender) { _layoutConfig = LayoutConfig; @@ -232,7 +238,15 @@ protected override async Task OnAfterRenderAsync(bool firstRender) /// /// /// - protected override Task InvokeInitAsync() => InvokeVoidAsync("init", Id, Interop, GetDockViewConfig()); + protected override Task InvokeInitAsync() + { + if (_disposed) + { + return Task.CompletedTask; + } + + return InvokeVoidAsync("init", Id, Interop, GetDockViewConfig()); + } private DockViewConfig GetDockViewConfig() { @@ -494,6 +508,7 @@ protected override ValueTask DisposeAsync(bool disposing) { if (disposing) { + _disposed = true; ThemeProviderService.ThemeChangedAsync -= OnThemeChangedAsync; }