Skip to content

Commit

Permalink
fix: app creation not updating sections correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Loxeris committed Apr 24, 2024
1 parent 203f2eb commit dc7982b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/ui/DashboardDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,14 @@ export default function DashboardDrawer(props: DashboardDrawerProps) {
icon: ComponentType,
) => {
let group = userSections[userSections.length - 1];
if (!group) {
const empty = !group;
if (empty) {
//create a new group if there is no group
group = {
title: `Group ${userSections.length + 1}`,
extended: false,
items: [],
};
setSections([group]);
}

let title = `${appType} ${userSections.reduce(
Expand All @@ -235,6 +235,13 @@ export default function DashboardDrawer(props: DashboardDrawerProps) {
path: path,
};
group.items.push(newApp);
if (empty) {
setSections([...userSections, group]);
} else {
setSections(
userSections.map((g) => (g.title === group.title ? group : g)),
);
}
};

let isContextStateStable = true;
Expand Down

0 comments on commit dc7982b

Please sign in to comment.