mirror of
https://github.com/RSSNext/Folo.git
synced 2026-10-16 20:51:43 +08:00
fix(desktop): keep the follow forms' switches controlled
Opening the list or feed follow form logged "A component is changing from uncontrolled to controlled": the Private Follow and Hide from Timeline switches had no value until the followed settings loaded. They now start off, and the values the form sends are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -452,7 +452,8 @@ const FeedInnerForm = ({
|
||||
<FormControl>
|
||||
<Switch
|
||||
className="shrink-0"
|
||||
checked={field.value}
|
||||
// Off until the form knows the followed setting, so the switch stays controlled
|
||||
checked={field.value ?? false}
|
||||
onCheckedChange={field.onChange}
|
||||
disabled={disabledForRole}
|
||||
/>
|
||||
@@ -479,7 +480,7 @@ const FeedInnerForm = ({
|
||||
<FormControl>
|
||||
<Switch
|
||||
className="shrink-0"
|
||||
checked={field.value}
|
||||
checked={field.value ?? false}
|
||||
onCheckedChange={field.onChange}
|
||||
disabled={disabledForRole}
|
||||
/>
|
||||
|
||||
@@ -329,7 +329,8 @@ const ListInnerForm = ({
|
||||
<FormControl>
|
||||
<Switch
|
||||
className="shrink-0"
|
||||
checked={field.value}
|
||||
// Off until the form knows the followed setting, so the switch stays controlled
|
||||
checked={field.value ?? false}
|
||||
onCheckedChange={field.onChange}
|
||||
disabled={disabledForRole && !isPrivateAlready}
|
||||
/>
|
||||
@@ -356,7 +357,7 @@ const ListInnerForm = ({
|
||||
<FormControl>
|
||||
<Switch
|
||||
className="shrink-0"
|
||||
checked={field.value}
|
||||
checked={field.value ?? false}
|
||||
onCheckedChange={field.onChange}
|
||||
disabled={disabledForRole && !isHiddenAlready}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user