fix random "element went from uncontrolled to controlled" warnings

This commit is contained in:
Grant 2024-05-25 22:42:20 -06:00
parent 94b4cdd3b8
commit 80c80057ee
2 changed files with 15 additions and 7 deletions

View File

@ -10,7 +10,11 @@ export const ChatSettings = () => {
return (
<>
<header>
<Switch size="sm" isSelected={loadChat} onValueChange={setLoadChat} />
<Switch
size="sm"
isSelected={loadChat || false}
onValueChange={setLoadChat}
/>
<h2>Chat</h2>
</header>
<section>

View File

@ -20,14 +20,18 @@ export const TemplateSettings = () => {
return (
<>
<header>
<Switch size="sm" isSelected={enable} onValueChange={setEnable} />
<Switch
size="sm"
isSelected={enable || false}
onValueChange={setEnable}
/>
<h2>Template</h2>
</header>
<section>
<Input
label="Template URL"
size="sm"
value={url}
value={url || ""}
onValueChange={setURL}
/>
<Input
@ -36,7 +40,7 @@ export const TemplateSettings = () => {
type="number"
min="1"
max={10_000}
value={width?.toString()}
value={width?.toString() || ""}
onValueChange={(v) => setWidth(parseInt(v))}
/>
<div className="flex flex-row gap-1">
@ -44,14 +48,14 @@ export const TemplateSettings = () => {
label="Template X"
size="sm"
type="number"
value={x.toString()}
value={x?.toString() || ""}
onValueChange={(v) => setX(parseInt(v))}
/>
<Input
label="Template Y"
size="sm"
type="number"
value={y.toString()}
value={y?.toString() || ""}
onValueChange={(v) => setY(parseInt(v))}
/>
</div>
@ -60,7 +64,7 @@ export const TemplateSettings = () => {
step={1}
minValue={0}
maxValue={100}
value={opacity}
value={opacity || 100}
onChange={(v) => setOpacity(v as number)}
getValue={(v) => v + "%"}
/>