From 1fd0c73127d51dfebe8436cf47704d39ce780e17 Mon Sep 17 00:00:00 2001 From: Scott Benton Date: Fri, 12 Apr 2024 19:48:47 -0400 Subject: [PATCH] fix(homebrew): Fixed homebrew autocompletes not clearing --- .../MoveCategoryDialog/MoveCategoryDialogForm.tsx | 6 +++--- .../MovesSection/MoveDialog/MoveDialogForm.tsx | 6 +++--- .../OracleSection/OracleTableRollableAutocomplete.tsx | 1 + .../OracleTablesCollectionDialogForm.tsx | 6 +++--- .../Sections/OracleTablesSection/OracleTableSimpleForm.tsx | 6 +++--- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/pages/Homebrew/HomebrewEditorPage/MovesSection/MoveCategoryDialog/MoveCategoryDialogForm.tsx b/src/pages/Homebrew/HomebrewEditorPage/MovesSection/MoveCategoryDialog/MoveCategoryDialogForm.tsx index 6ddfc171..52878141 100644 --- a/src/pages/Homebrew/HomebrewEditorPage/MovesSection/MoveCategoryDialog/MoveCategoryDialogForm.tsx +++ b/src/pages/Homebrew/HomebrewEditorPage/MovesSection/MoveCategoryDialog/MoveCategoryDialogForm.tsx @@ -144,7 +144,7 @@ export function MoveCategoryDialogForm(props: MoveCategoryFormDialogProps) { }} /> ( field.onChange(ids)} + onChange={(ids) => field.onChange(ids ?? null)} onBlur={field.onBlur} helperText={ "Replaces the category (and all moves within) with this category" @@ -177,7 +177,7 @@ export function MoveCategoryDialogForm(props: MoveCategoryFormDialogProps) { field.onChange(ids)} + onChange={(ids) => field.onChange(ids ?? null)} onBlur={field.onBlur} helperText={ "Adds moves in this category to the entered category" diff --git a/src/pages/Homebrew/HomebrewEditorPage/MovesSection/MoveDialog/MoveDialogForm.tsx b/src/pages/Homebrew/HomebrewEditorPage/MovesSection/MoveDialog/MoveDialogForm.tsx index 665ad77d..4404e0e0 100644 --- a/src/pages/Homebrew/HomebrewEditorPage/MovesSection/MoveDialog/MoveDialogForm.tsx +++ b/src/pages/Homebrew/HomebrewEditorPage/MovesSection/MoveDialog/MoveDialogForm.tsx @@ -206,7 +206,7 @@ export function MoveDialogForm(props: MoveFormDialogProps) { }} /> ( field.onChange(ids)} + onChange={(ids) => field.onChange(ids ?? null)} onBlur={field.onBlur} disabled={disabled} helperText={"Replaces an existing move with this one."} @@ -292,7 +292,7 @@ export function MoveDialogForm(props: MoveFormDialogProps) { field.onChange(ids)} + onChange={(ids) => field.onChange(ids ?? [])} onBlur={field.onBlur} disabled={disabled} helperText={"Legacy Tracks you would like to roll against"} diff --git a/src/pages/Homebrew/HomebrewEditorPage/OracleSection/OracleTableRollableAutocomplete.tsx b/src/pages/Homebrew/HomebrewEditorPage/OracleSection/OracleTableRollableAutocomplete.tsx index 2a7fb019..41c1b043 100644 --- a/src/pages/Homebrew/HomebrewEditorPage/OracleSection/OracleTableRollableAutocomplete.tsx +++ b/src/pages/Homebrew/HomebrewEditorPage/OracleSection/OracleTableRollableAutocomplete.tsx @@ -41,6 +41,7 @@ export function OracleTableRollableAutocomplete( )} value={value ?? null} onChange={(evt, value) => { + console.debug(value); onChange(value ?? undefined); }} onBlur={onBlur} diff --git a/src/pages/Homebrew/HomebrewEditorPage/OracleSection/Sections/OracleCollectionsSection/OracleTablesCollectionDialogForm.tsx b/src/pages/Homebrew/HomebrewEditorPage/OracleSection/Sections/OracleCollectionsSection/OracleTablesCollectionDialogForm.tsx index 9ab96a8e..388e4391 100644 --- a/src/pages/Homebrew/HomebrewEditorPage/OracleSection/Sections/OracleCollectionsSection/OracleTablesCollectionDialogForm.tsx +++ b/src/pages/Homebrew/HomebrewEditorPage/OracleSection/Sections/OracleCollectionsSection/OracleTablesCollectionDialogForm.tsx @@ -161,7 +161,7 @@ export function OracleTablesCollectionDialogForm( }} /> ( field.onChange(ids)} + onChange={(ids) => field.onChange(ids ?? null)} onBlur={field.onBlur} helperText={ "Replaces all oracles within the given collection" @@ -194,7 +194,7 @@ export function OracleTablesCollectionDialogForm( field.onChange(ids)} + onChange={(ids) => field.onChange(ids ?? null)} onBlur={field.onBlur} helperText={ "Adds oracles in this collection to the entered collection" diff --git a/src/pages/Homebrew/HomebrewEditorPage/OracleSection/Sections/OracleTablesSection/OracleTableSimpleForm.tsx b/src/pages/Homebrew/HomebrewEditorPage/OracleSection/Sections/OracleTablesSection/OracleTableSimpleForm.tsx index 8b1921e8..3ccd03a9 100644 --- a/src/pages/Homebrew/HomebrewEditorPage/OracleSection/Sections/OracleTablesSection/OracleTableSimpleForm.tsx +++ b/src/pages/Homebrew/HomebrewEditorPage/OracleSection/Sections/OracleTablesSection/OracleTableSimpleForm.tsx @@ -160,7 +160,7 @@ export function OracleTableSimpleForm(props: OracleTableSimpleFormProps) { }} /> ( field.onChange(ids)} + onChange={(ids) => field.onChange(ids ?? null)} onBlur={field.onBlur} helperText={"Replaces an existing oracle table with this one"} /> @@ -191,7 +191,7 @@ export function OracleTableSimpleForm(props: OracleTableSimpleFormProps) { disabled={disabled} control={ (