Skip to content

Commit 013a971

Browse files
DavidShawaclaude
andcommitted
fix: address CodeRabbit review on effort panel and OpenAI setup flow
- EffortPanelWrapper: invoke onDone from useEffect instead of during render when the current model does not support effort, avoiding cross-component render-phase updates - ConsoleOAuthFlow: memoize openaiDisplayValues so doOpenAISave and handleOpenAIEnter callback references stay stable across renders Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 383410c commit 013a971

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

src/commands/effort/effort.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,13 @@ export async function call(onDone: LocalJSXCommandOnDone, _context: unknown, arg
174174
function EffortPanelWrapper({ onDone }: { onDone: (result: string) => void }): React.ReactNode {
175175
const effortValue = useAppState(s => s.effortValue);
176176
const model = useMainLoopModel();
177-
if (!modelSupportsEffort(model)) {
178-
onDone('Effort is disabled because thinking is disabled for the current model.');
177+
const supported = modelSupportsEffort(model);
178+
React.useEffect(() => {
179+
if (!supported) {
180+
onDone('Effort is disabled because thinking is disabled for the current model.');
181+
}
182+
}, [supported, onDone]);
183+
if (!supported) {
179184
return null;
180185
}
181186
return <EffortPanel appStateEffort={effortValue} onDone={onDone} />;

src/components/ConsoleOAuthFlow.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback, useEffect, useRef, useState } from 'react';
1+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
22
import {
33
type AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
44
logEvent,
@@ -825,13 +825,16 @@ function OAuthStatusMessage({
825825
thinkingEnabled: boolean;
826826
};
827827
const { activeField, baseUrl, apiKey, haikuModel, sonnetModel, opusModel, thinkingEnabled } = op;
828-
const openaiDisplayValues: Record<Exclude<OpenAIField, 'thinking_enabled'>, string> = {
829-
base_url: baseUrl,
830-
api_key: apiKey,
831-
haiku_model: haikuModel,
832-
sonnet_model: sonnetModel,
833-
opus_model: opusModel,
834-
};
828+
const openaiDisplayValues = useMemo<Record<Exclude<OpenAIField, 'thinking_enabled'>, string>>(
829+
() => ({
830+
base_url: baseUrl,
831+
api_key: apiKey,
832+
haiku_model: haikuModel,
833+
sonnet_model: sonnetModel,
834+
opus_model: opusModel,
835+
}),
836+
[baseUrl, apiKey, haikuModel, sonnetModel, opusModel],
837+
);
835838
const getOpenAIFieldValue = (field: OpenAIField): string =>
836839
field === 'thinking_enabled' ? '' : openaiDisplayValues[field];
837840

0 commit comments

Comments
 (0)