Skip to content

Bugfix/state refresh in model table#13

Merged
Louis-7 merged 2 commits intomainfrom
bugfix/state-refresh-in-model-table
Oct 31, 2025
Merged

Bugfix/state refresh in model table#13
Louis-7 merged 2 commits intomainfrom
bugfix/state-refresh-in-model-table

Conversation

@Louis-7
Copy link
Contributor

@Louis-7 Louis-7 commented Oct 31, 2025

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

  • Bug fix
  • New feature
  • Documentation update
  • Refactor
  • Other

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

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.
Copilot AI review requested due to automatic review settings October 31, 2025 10:13
Copy link

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

@Louis-7 Louis-7 merged commit c09771b into main Oct 31, 2025
7 checks passed
@Louis-7 Louis-7 deleted the bugfix/state-refresh-in-model-table branch October 31, 2025 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant