🐛 Make sure switches are controlled

This commit is contained in:
Luke Vella 2024-09-21 15:27:44 +01:00
parent 0b808259ab
commit 309820f072
No known key found for this signature in database
GPG key ID: 469CAD687F0D784C

View file

@ -105,7 +105,7 @@ export const PollSettingsForm = ({ children }: React.PropsWithChildren) => {
</SettingContent> </SettingContent>
<Switch <Switch
id={field.name} id={field.name}
checked={field.value} checked={!!field.value}
onCheckedChange={(checked) => { onCheckedChange={(checked) => {
field.onChange(checked); field.onChange(checked);
}} }}
@ -128,7 +128,7 @@ export const PollSettingsForm = ({ children }: React.PropsWithChildren) => {
</SettingTitle> </SettingTitle>
</SettingContent> </SettingContent>
<Switch <Switch
checked={field.value} checked={!!field.value}
onCheckedChange={(checked) => { onCheckedChange={(checked) => {
if (isFree) { if (isFree) {
paywallDialog.trigger(); paywallDialog.trigger();
@ -159,7 +159,7 @@ export const PollSettingsForm = ({ children }: React.PropsWithChildren) => {
</SettingTitle> </SettingTitle>
</SettingContent> </SettingContent>
<Switch <Switch
checked={field.value} checked={!!field.value}
onCheckedChange={(checked) => { onCheckedChange={(checked) => {
if (isFree) { if (isFree) {
paywallDialog.trigger(); paywallDialog.trigger();
@ -191,7 +191,7 @@ export const PollSettingsForm = ({ children }: React.PropsWithChildren) => {
</SettingContent> </SettingContent>
<Switch <Switch
id={field.name} id={field.name}
checked={field.value} checked={!!field.value}
onCheckedChange={(checked) => { onCheckedChange={(checked) => {
if (isFree) { if (isFree) {
paywallDialog.trigger(); paywallDialog.trigger();