Skip to content

Commit

Permalink
fix empty category still appearing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
boyazeng committed Apr 25, 2024
1 parent 64c55e4 commit eb30c31
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ const handleDeleteTab = (id: number) => {
for (const category in updatedTabsByCategory) {
if (updatedTabsByCategory.hasOwnProperty(category)) {
updatedTabsByCategory[category] = updatedTabsByCategory[category].filter(tab => tab.id !== mainId);
if (updatedTabsByCategory[category].length === 0) {
delete updatedTabsByCategory[category];
}
}
}
setFullTabsByCategory(updatedTabsByCategory);
Expand Down

0 comments on commit eb30c31

Please sign in to comment.