@@ -131,7 +131,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
131131 const { t } = useAppTranslation ( )
132132
133133 const extensionState = useExtensionState ( )
134- const { currentApiConfigName, listApiConfigMeta, uriScheme, settingsImportedAt } = extensionState
134+ const { currentApiConfigName, listApiConfigMeta, uriScheme, settingsImportedAt, mode } = extensionState
135135
136136 const [ isDiscardDialogShow , setDiscardDialogShow ] = useState ( false )
137137 const [ isChangeDetected , setChangeDetected ] = useState ( false )
@@ -151,6 +151,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
151151 const contentRef = useRef < HTMLDivElement | null > ( null )
152152
153153 const prevApiConfigName = useRef ( currentApiConfigName )
154+ const prevMode = useRef ( mode )
154155 const handledSettingsImportedAt = useRef < number | undefined > ( undefined )
155156 const confirmDialogHandler = useRef < ( ) => void > ( )
156157
@@ -225,16 +226,17 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
225226 const apiConfiguration = useMemo ( ( ) => cachedState . apiConfiguration ?? { } , [ cachedState . apiConfiguration ] )
226227
227228 useEffect ( ( ) => {
228- // Update only when currentApiConfigName is changed .
229- // Expected to be triggered by loadApiConfiguration/upsertApiConfiguration.
230- if ( prevApiConfigName . current === currentApiConfigName ) {
229+ // Update when currentApiConfigName or mode changes .
230+ // Expected to be triggered by loadApiConfiguration/upsertApiConfiguration or mode switch .
231+ if ( prevApiConfigName . current === currentApiConfigName && prevMode . current === mode ) {
231232 return
232233 }
233234
234235 setCachedState ( ( prevCachedState ) => ( { ...prevCachedState , ...extensionState } ) )
235236 prevApiConfigName . current = currentApiConfigName
237+ prevMode . current = mode
236238 setChangeDetected ( false )
237- } , [ currentApiConfigName , extensionState ] )
239+ } , [ currentApiConfigName , mode , extensionState ] )
238240
239241 // Bust the cache when settings are imported.
240242 useEffect ( ( ) => {
0 commit comments