refresh submenu items on workspace switch
This commit is contained in:
parent
bffb99d873
commit
bfef33f63b
2 changed files with 9 additions and 5 deletions
|
|
@ -197,7 +197,7 @@ export class ConfigHandler {
|
|||
async setSelectedProfile(profileId: string) {
|
||||
this.selectedProfileId = profileId;
|
||||
const newConfig = await this.loadConfig();
|
||||
this.notifyConfigListerners(newConfig);
|
||||
this.notifyConfigListeners(newConfig);
|
||||
const selectedProfiles =
|
||||
this.globalContext.get("lastSelectedProfileForWorkspace") ?? {};
|
||||
selectedProfiles[await this.getWorkspaceId()] = profileId;
|
||||
|
|
@ -241,7 +241,7 @@ export class ConfigHandler {
|
|||
}
|
||||
}
|
||||
|
||||
private notifyConfigListerners(newConfig: ContinueConfig) {
|
||||
private notifyConfigListeners(newConfig: ContinueConfig) {
|
||||
// Notify listeners that config changed
|
||||
for (const listener of this.updateListeners) {
|
||||
listener(newConfig);
|
||||
|
|
@ -257,7 +257,7 @@ export class ConfigHandler {
|
|||
// TODO: this isn't right, there are two different senses in which you want to "reload"
|
||||
const newConfig = await this.currentProfile.reloadConfig();
|
||||
this.inactiveProfiles.forEach((profile) => profile.clearConfig());
|
||||
this.notifyConfigListerners(newConfig);
|
||||
this.notifyConfigListeners(newConfig);
|
||||
}
|
||||
|
||||
getSerializedConfig(): Promise<BrowserSerializedContinueConfig> {
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ const MINISEARCH_OPTIONS = {
|
|||
const MAX_LENGTH = 70;
|
||||
|
||||
function useSubmenuContextProviders() {
|
||||
// TODO: Refresh periodically
|
||||
|
||||
const [minisearches, setMinisearches] = useState<{
|
||||
[id: string]: MiniSearch;
|
||||
}>({});
|
||||
|
|
@ -228,6 +226,12 @@ function useSubmenuContextProviders() {
|
|||
});
|
||||
}, [contextProviderDescriptions, loaded]);
|
||||
|
||||
useWebviewListener("configUpdate", async () => {
|
||||
// When config is updated (for example switching to a different workspace)
|
||||
// we need to reload the context providers.
|
||||
setLoaded(false);
|
||||
});
|
||||
|
||||
return {
|
||||
getSubmenuContextItems,
|
||||
addItem,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue