-
-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: uncontrolled input in dashboard #895
base: main
Are you sure you want to change the base?
Conversation
OPENAI_API_KEY: '', | ||
ANTHROPIC_API_KEY: '', | ||
GOOGLE_API_KEY: '', | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like the third place we are duplicating configuration setting names. Is there any way to populate this dynmamically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we populate this dynamically using config file but sometimes we might get undefined values which might be the reason for warning. So, I added these default values
@@ -32,19 +32,19 @@ export const Form = ({ | |||
<form onSubmit={form.onSubmit(saveSettings(form))}> | |||
<Grid> | |||
<Grid.Col span={6}> | |||
<Checkbox label="Record window data" {...form.getInputProps('RECORD_WINDOW_DATA')} checked={form.values.RECORD_WINDOW_DATA} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this prevent the checkboxes from being checked appropriately depending on the configuration values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...form.getInputProps('RECORD_WINDOW_DATA')
this alone should've marked this checked but yes now that I tested it again without checked=
property it is not being marked appropriately.
What kind of change does this PR introduce?
a Bugfix for #889
Summary
checked
property: This avoids conflicting control by lettinggetInputProps
fully manage the checkbox state.defaultSettings
which provides default values for all fields, preventing uncontrolled-to-controlled issues.Checklist
How can your code be run and tested?