bug fix attempt
mellbacon committed
Sep 14, 2022 at 10:00 UTC
4fece70babf8db6d67f1b561486917384dbf260a
1 file changed
+14
-8
src/components/Content/Editor/Tabs.ts
+14
-8
@@ -70,17 +70,23 @@ function updateEditorVisibility() {
70
}
71
72
export function closeTab(tabid: number) {
73
- tablist[tabid].editor.$destroy();
73
+ tablist.find(t => t.id === tabid).editor.$destroy();
74
tablist = tablist.filter(t => t.id !== tabid);
75
- tabs.set(tablist);
76
- for (let _ of tablist) {
77
- if (activeid >= tablist.length - 1) {
78
- setActive(tabid - 1);
79
- }
80
- else {
81
- setActive(tabid + 1);
75
+
76
+ for (let i = 0; i < tablist.length - 1; i++) {
77
+ if (tablist[i].id === tabid) {
78
+
79
}
80
}
81
+ // TODO: Fix logic here
82
+ if (activeid >= tablist.length - 1) {
83
+ setActive(tabid - 1);
84
+ }
85
+ else {
86
+ setActive(tabid + 1);
87
+ }
88
+ tabs.set(tablist);
89
+
90
updateEditorVisibility();
91
if (tablist.length === 0) {
92
hidden.set(true);