summaryrefslogtreecommitdiff
path: root/Pages/Component
diff options
context:
space:
mode:
authorJake Mannens <jake@asger.xyz>2023-08-28 23:34:45 +1000
committerJake Mannens <jake@asger.xyz>2023-08-28 23:34:45 +1000
commitb635a6581560f5c01311969779e974e6caca3f54 (patch)
tree2491f99dfc6807d3600cba0f34e7ea727fdd4df4 /Pages/Component
parent05e0c2d26ccdbbcb2ce7de2c8c0fc8f0246fa709 (diff)
Fixed tab container tab duplication bug
Diffstat (limited to 'Pages/Component')
-rw-r--r--Pages/Component/TabContainer.razor5
-rw-r--r--Pages/Component/TabPane.razor8
2 files changed, 12 insertions, 1 deletions
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 @@
-<link rel="stylesheet" href="@(nameof(HyperBooru)).styles.css"/>
+@implements IDisposable
+
+<link rel="stylesheet" href="@(nameof(HyperBooru)).styles.css"/>
@if(Parent.ActivePane == this) {
@ChildContent
@@ -20,4 +22,8 @@
Parent.AddPane(this);
}
+
+ public void Dispose() {
+ Parent.RemovePane(this);
+ }
} \ No newline at end of file