@@ -130,7 +130,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
130130 const { t } = useAppTranslation ( )
131131
132132 const extensionState = useExtensionState ( )
133- const { currentApiConfigName, listApiConfigMeta, uriScheme, settingsImportedAt } = extensionState
133+ const { currentApiConfigName, listApiConfigMeta, uriScheme, settingsImportedAt, mode } = extensionState
134134
135135 const [ isDiscardDialogShow , setDiscardDialogShow ] = useState ( false )
136136 const [ isChangeDetected , setChangeDetected ] = useState ( false )
@@ -147,6 +147,7 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
147147 const contentRef = useRef < HTMLDivElement | null > ( null )
148148
149149 const prevApiConfigName = useRef ( currentApiConfigName )
150+ const prevMode = useRef ( mode )
150151 const handledSettingsImportedAt = useRef < number | undefined > ( undefined )
151152 const confirmDialogHandler = useRef < ( ) => void > ( )
152153
@@ -220,16 +221,17 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
220221 const apiConfiguration = useMemo ( ( ) => cachedState . apiConfiguration ?? { } , [ cachedState . apiConfiguration ] )
221222
222223 useEffect ( ( ) => {
223- // Update only when currentApiConfigName is changed .
224- // Expected to be triggered by loadApiConfiguration/upsertApiConfiguration.
225- if ( prevApiConfigName . current === currentApiConfigName ) {
224+ // Update when currentApiConfigName or mode changes .
225+ // Expected to be triggered by loadApiConfiguration/upsertApiConfiguration or mode switch .
226+ if ( prevApiConfigName . current === currentApiConfigName && prevMode . current === mode ) {
226227 return
227228 }
228229
229230 setCachedState ( ( prevCachedState ) => ( { ...prevCachedState , ...extensionState } ) )
230231 prevApiConfigName . current = currentApiConfigName
232+ prevMode . current = mode
231233 setChangeDetected ( false )
232- } , [ currentApiConfigName , extensionState ] )
234+ } , [ currentApiConfigName , mode , extensionState ] )
233235
234236 // Bust the cache when settings are imported.
235237 useEffect ( ( ) => {
0 commit comments