Skip to content

fix: system model selector loading state flash#30572

Merged
crazywoola merged 4 commits intomainfrom
fix/system-model-selector-loading-state
Jan 6, 2026
Merged

fix: system model selector loading state flash#30572
crazywoola merged 4 commits intomainfrom
fix/system-model-selector-loading-state

Conversation

@lyzno1
Copy link
Member

@lyzno1 lyzno1 commented Jan 5, 2026

Fixes #30569

Summary

Screenshots

Before After
CleanShot 2026-01-05 at 17 14 47 CleanShot 2026-01-05 at 17 15 54

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint and make type-check (backend) and cd web && npx lint-staged (frontend) to appease the lint gods
Copilot AI review requested due to automatic review settings January 5, 2026 08:14
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jan 5, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • Loading State Management: Extracted individual isLoading states from useDefaultModel hooks for various model types (text generation, embeddings, rerank, speech-to-text, and TTS) to accurately track data fetching status.
  • Combined Loading Indicator: Introduced a consolidated isDefaultModelLoading flag that aggregates all individual model loading states, providing a single source of truth for the overall loading status of system models.
  • UI Responsiveness during Loading: Passed the isLoading state to the SystemModel component, which now disables the system model settings button and prevents interaction while data is being fetched. The button's icon dynamically changes to a spinning loader during this period.
  • Improved User Experience: The changes prevent a 'flash' or flickering UI by ensuring the system model selector button correctly reflects its loading state, offering a smoother user experience.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 useDefaultModel hooks to track when model data is being fetched
  • Implemented visual loading feedback with a spinner icon in the system model selector button
  • Updated the defaultModelNotConfigured logic 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.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 6, 2026
@crazywoola crazywoola merged commit f14c3ce into main Jan 6, 2026
16 checks passed
@crazywoola crazywoola deleted the fix/system-model-selector-loading-state branch January 6, 2026 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

4 participants