fix: eliminate model info flicker during settings save#9101
Closed
daniel-lxs wants to merge 1 commit intomainfrom
Closed
fix: eliminate model info flicker during settings save#9101daniel-lxs wants to merge 1 commit intomainfrom
daniel-lxs wants to merge 1 commit intomainfrom
Conversation
…act state cache Fixes #4430 Replace complex cross-window persistence system with a minimal 3-line React state solution that caches the last known ModelInfo and uses it as a fallback when selectedModelInfo temporarily becomes unavailable during settings save. This simple in-memory approach eliminates the flicker without adding complexity, cross-window coordination, or background revalidation.
Contributor
Review found 2 areas where the flicker fix is incomplete:
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
Member
Author
|
Closing this PR as it doesn't address the root cause of #4430. The issue is not about model info flicker in the UI, but about the backend unconditionally rebuilding the API handler on Save, which triggers context condensing. Opening a new PR with the correct fix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.