fix: system model selector loading state flash#30572
Conversation
Summary of ChangesHello @lyzno1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a UI/UX issue where the system model selector button would 'flash' or flicker during its loading state. The solution involves refining the management of loading states from data fetching hooks, consolidating them into a single indicator, and then using this indicator to disable the button and display a loading spinner. This ensures a more stable and intuitive user interface while model data is being retrieved. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses the UI flash in the system model selector by introducing and managing loading states for default models. The changes are logical and correctly implemented. I've added a couple of suggestions to improve the maintainability of how loading states and model configurations are checked, which should make future modifications easier.
There was a problem hiding this comment.
Pull request overview
This PR fixes a loading state flash issue in the system model selector by implementing proper loading state tracking. When the component mounts, default model data is being fetched asynchronously, and the component now properly indicates this loading state instead of flashing the "not configured" state.
Key Changes:
- Added loading state extraction from
useDefaultModelhooks to track when model data is being fetched - Implemented visual loading feedback with a spinner icon in the system model selector button
- Updated the
defaultModelNotConfiguredlogic to account for loading state, preventing premature "not configured" indication
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
web/app/components/header/account-setting/model-provider-page/index.tsx | Extracts loading states from all useDefaultModel hooks, combines them into isDefaultModelLoading, and updates the defaultModelNotConfigured check to prevent false positives during loading. Passes loading state to SystemModelSelector component. |
web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx | Adds isLoading prop, implements loading UI with spinner icon, disables button interactions during loading to prevent premature user interaction. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes #30569
Summary
Screenshots
Checklist
make lintandmake type-check(backend) andcd web && npx lint-staged(frontend) to appease the lint gods