fix: eliminate model info flicker during settings save #9101
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #4430
Problem
When settings are saved, dynamic providers (OpenRouter, LiteLLM, DeepInfra, Roo, etc.) briefly show generic fallback model info while their model lists reload, causing a visual flicker.
Solution
Added a simple in-memory cache in ApiOptions component that:
Implementation
Just 3 lines of React state:
No persistence, no cross-window coordination, no background revalidation - just a simple bridge to prevent flicker during settings save.
Testing
Manually tested settings save flow - no flicker observed.
Important
Adds in-memory cache in
ApiOptionsto prevent model info flicker during settings save by using cached data as fallback.ApiOptionsto store last knownModelInfo.ModelInfoas fallback whenselectedModelInfois unavailable.ModelInfois loaded.lastKnownModelInfostate anduseEffectto update it inApiOptions.selectedModelInfowithdisplayModelInfoin relevant JSX conditions.This description was created by
for d6a4265. You can customize this summary. It will automatically update as commits are pushed.