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:
DIYgod
2026-10-12 23:23:36 +08:00
parent a73a8b6407
commit 48d55c9fba
2 changed files with 6 additions and 4 deletions
@@ -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}
/>