Fix custom models not showing in dropdown without force reload#1342
Fix custom models not showing in dropdown without force reload#1342
Conversation
📝 WalkthroughWalkthroughThe page imports Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request adds cache invalidation logic to the model settings page. By calling clear_available_models_cache after loading data, it ensures that model dropdowns are updated correctly when models are added or modified. I have no feedback to provide.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/web_ui/src/routes/(app)/settings/providers/add_models/+page.svelte (1)
298-308:⚠️ Potential issue | 🟡 MinorConsider clearing the cache even when the DELETE fails, and consider early-return semantics.
On
delete_errorthe code alerts but still falls through toload_data()andclear_available_models_cache(). That's probably fine (and arguably desirable, since the server state is unknown after an error), but it's worth being deliberate:
- If you intend to treat the failure as "no-op", early-return after the alert so the list/cache aren't needlessly refreshed.
- If you intend to stay resilient (refresh in case partial state changed), keep as-is — the current change is correct for that interpretation.
No behavior change required for this PR; just flagging for intent.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/web_ui/src/routes/`(app)/settings/providers/add_models/+page.svelte around lines 298 - 308, The delete handler currently alerts on delete_error but then continues to call load_data() and clear_available_models_cache(); decide which semantics you want and make it explicit: if failure should be treated as a no-op, add an early return immediately after the alert (so don't call load_data() or clear_available_models_cache()); if you want resilient behavior (refresh despite the error), leave the calls to load_data() and clear_available_models_cache() as-is but add a comment near delete_error, load_data(), and clear_available_models_cache() to document that refresh/cache invalidation is intentional on failure.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@app/web_ui/src/routes/`(app)/settings/providers/add_models/+page.svelte:
- Around line 298-308: The delete handler currently alerts on delete_error but
then continues to call load_data() and clear_available_models_cache(); decide
which semantics you want and make it explicit: if failure should be treated as a
no-op, add an early return immediately after the alert (so don't call
load_data() or clear_available_models_cache()); if you want resilient behavior
(refresh despite the error), leave the calls to load_data() and
clear_available_models_cache() as-is but add a comment near delete_error,
load_data(), and clear_available_models_cache() to document that refresh/cache
invalidation is intentional on failure.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 8e35eb8c-9974-4ea9-b2ce-cbddb3a70b47
📒 Files selected for processing (1)
app/web_ui/src/routes/(app)/settings/providers/add_models/+page.svelte
📊 Coverage ReportOverall Coverage: 92% Diff: origin/main...HEADNo lines with coverage information in this diff.
|
Summary by CodeRabbit