Merged
Conversation
When users update the provider configuration, the values in settings.json are updated, but React doesn't recognize this change because the settings were passed in as a prop and remain static. We need to manage this as state so that when the configuration is updated, the child components can receive the latest changes as well.
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the OpenAI provider settings UI to use controlled components with local state management, improving form input behavior. It also includes minor improvements to TypeScript type inference and code organization.
- Converted OpenAI settings form inputs from uncontrolled (
defaultValue) to controlled (value) components with dedicated local state - Removed redundant type annotation in OpenAIProvider filter callback, relying on TypeScript's type inference
- Reorganized ModelTable hooks to follow React Hooks rules (hooks before other logic)
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/services/providers/OpenAIProvider.ts | Simplified type annotation by removing explicit parameter type from filter callback |
| src/pages/Settings/Models/ProviderOpenAI.tsx | Added local state management and change handlers to convert form inputs to controlled components |
| src/components/ModelTable.tsx | Moved useEffect hook to execute before other function definitions for better code organization |
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.
Pull Request Template
Description
Fix a bug where users update a provider's host but the changes don't take effect immediately.
Type of Change
Checklist