mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
fix(connection): keep selected app when switching platform
Switching the platform dropdown always reset the app to the new platform's featured/first one, discarding the user's choice (e.g. picked Happ → switched platform → snapped back to the first app). Now it keeps the same app by name if it exists on the new platform, falling back to featured/first only otherwise.
This commit is contained in:
@@ -266,7 +266,12 @@ export default function InstallationGuide({
|
|||||||
setActivePlatformKey(newPlatform);
|
setActivePlatformKey(newPlatform);
|
||||||
const data = appConfig.platforms[newPlatform] as RemnawavePlatformData | undefined;
|
const data = appConfig.platforms[newPlatform] as RemnawavePlatformData | undefined;
|
||||||
if (data?.apps?.length) {
|
if (data?.apps?.length) {
|
||||||
const app = data.apps.find((a) => a.featured) || data.apps[0];
|
// Keep the user's current app (by name) if it also exists on the
|
||||||
|
// new platform; only fall back to featured/first otherwise.
|
||||||
|
const app =
|
||||||
|
data.apps.find((a) => a.name === selectedApp?.name) ||
|
||||||
|
data.apps.find((a) => a.featured) ||
|
||||||
|
data.apps[0];
|
||||||
if (app) setSelectedApp(app);
|
if (app) setSelectedApp(app);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user