correctly persist selected profile

This commit is contained in:
Nate 2025-03-11 17:14:10 -07:00
parent dc94857631
commit ce24a200f5
3 changed files with 11 additions and 5 deletions

View file

@ -295,8 +295,11 @@ export class Core {
this.configHandler.updateIdeSettings(msg.data);
});
on("config/listProfiles", (msg) => {
return this.configHandler.listProfiles();
on("config/listProfiles", async (msg) => {
const profiles = this.configHandler.listProfiles();
const selectedProfileId =
this.configHandler.currentProfile?.profileDescription.id ?? null;
return { profiles, selectedProfileId };
});
on("config/refreshProfiles", async (msg) => {

View file

@ -68,7 +68,10 @@ export type ToCoreFromIdeOrWebviewProtocol = {
"config/deleteModel": [{ title: string }, void];
"config/addContextProvider": [ContextProviderWithParams, void];
"config/reload": [undefined, ConfigResult<BrowserSerializedContinueConfig>];
"config/listProfiles": [undefined, ProfileDescription[] | null];
"config/listProfiles": [
undefined,
{ profiles: ProfileDescription[] | null; selectedProfileId: string | null },
];
"config/refreshProfiles": [undefined, void];
"config/openProfile": [{ profileId: string | undefined }, void];
"config/updateSharedConfig": [SharedConfigSchema, SharedConfigSchema];

View file

@ -168,8 +168,8 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
if (result.status === "success") {
dispatch(
updateProfilesThunk({
profiles: result.content,
selectedProfileId: null,
profiles: result.content.profiles,
selectedProfileId: result.content.selectedProfileId,
}),
);
}