From b635a6581560f5c01311969779e974e6caca3f54 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Mon, 28 Aug 2023 23:34:45 +1000 Subject: Fixed tab container tab duplication bug --- Pages/Component/TabContainer.razor | 5 +++++ Pages/Component/TabPane.razor | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'Pages') diff --git a/Pages/Component/TabContainer.razor b/Pages/Component/TabContainer.razor index 0dc1924..ed61f49 100644 --- a/Pages/Component/TabContainer.razor +++ b/Pages/Component/TabContainer.razor @@ -25,4 +25,9 @@ ActivePane = tabPane; StateHasChanged(); } + + public void RemovePane(TabPane tabPane) { + Panes.Remove(tabPane); + StateHasChanged(); + } } \ No newline at end of file diff --git a/Pages/Component/TabPane.razor b/Pages/Component/TabPane.razor index 483d0d6..ba4a13a 100644 --- a/Pages/Component/TabPane.razor +++ b/Pages/Component/TabPane.razor @@ -1,4 +1,6 @@ - +@implements IDisposable + + @if(Parent.ActivePane == this) { @ChildContent @@ -20,4 +22,8 @@ Parent.AddPane(this); } + + public void Dispose() { + Parent.RemovePane(this); + } } \ No newline at end of file -- cgit v1.3