Skip to content

Commit c1b9fcd

Browse files
committed
Fix issue where planActSeparateModelsSetting was initialized with non-undefined value
1 parent d470ba9 commit c1b9fcd

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/core/webview/ClineProvider.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ export class ClineProvider implements vscode.WebviewViewProvider {
143143
// Set defaults for new users
144144
;(async () => {
145145
const existingPlanActSeparateModelsSetting = await this.getGlobalState("planActSeparateModelsSetting")
146-
if (existingPlanActSeparateModelsSetting === undefined) {
146+
// initial state may be undefined or empty string, so we check for existence of expected values
147+
if (existingPlanActSeparateModelsSetting !== true && existingPlanActSeparateModelsSetting !== false) {
147148
// If api provider is not set, it's a new user. In order to get past the welcome screen, the user needs to choose an api provider and api key (logging into cline sets provider to cline). This is a good opportunity to set values for NEW users that we don't want to modify defaults for existing users. For example, existing users may already be using model switching between plan/act, but new users shouldn't be opted in to this behavior by default.
148149
const apiProvider = await this.getGlobalState("apiProvider")
149150
if (!apiProvider) {
@@ -1989,7 +1990,7 @@ Here is the project's README to help you get started:\n\n${mcpDetails.readmeCont
19891990
asksageApiUrl,
19901991
xaiApiKey,
19911992
thinkingBudgetTokens,
1992-
planActSeparateModelsSetting,
1993+
planActSeparateModelsSettingRaw,
19931994
] = await Promise.all([
19941995
this.getGlobalState("apiProvider") as Promise<ApiProvider | undefined>,
19951996
this.getGlobalState("apiModelId") as Promise<string | undefined>,
@@ -2072,6 +2073,12 @@ Here is the project's README to help you get started:\n\n${mcpDetails.readmeCont
20722073

20732074
const mcpMarketplaceEnabled = vscode.workspace.getConfiguration("cline").get<boolean>("mcpMarketplace.enabled", true)
20742075

2076+
// On win11 state sometimes initializes as empty string instead of undefined
2077+
let planActSeparateModelsSetting: boolean | undefined = undefined
2078+
if (planActSeparateModelsSettingRaw === true || planActSeparateModelsSettingRaw === false) {
2079+
planActSeparateModelsSetting = planActSeparateModelsSettingRaw
2080+
}
2081+
20752082
return {
20762083
apiConfiguration: {
20772084
apiProvider,

0 commit comments

Comments
 (0)