Skip to content

Commit 719c44d

Browse files
committed
fix
1 parent 9b8d0d3 commit 719c44d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/sidebarApps/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,16 @@ function ensureActiveApp() {
129129
if (activeApps.length === 1) return;
130130

131131
if (activeApps.length > 1) {
132-
setActiveApp(activeApps[0].id);
132+
const preferredActiveApp = activeApps.find(
133+
(app) => app.id === currentSection,
134+
);
135+
setActiveApp(preferredActiveApp?.id || activeApps[0].id);
133136
return;
134137
}
135138

136139
if (apps.length > 0) {
137-
setActiveApp(apps[0].id);
140+
const preferredApp = apps.find((app) => app.id === currentSection);
141+
setActiveApp(preferredApp?.id || apps[0].id);
138142
}
139143
}
140144

0 commit comments

Comments
 (0)