From e47dcc8782e1fd40d444500017ed100d9531e873 Mon Sep 17 00:00:00 2001 From: valadaptive Date: Wed, 3 Jan 2024 15:59:16 -0500 Subject: [PATCH] Cleanup --- .../CharacterList/CharacterList.tsx | 28 ++++++++++--------- src/util/store.ts | 2 +- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/components/CharacterList/CharacterList.tsx b/src/components/CharacterList/CharacterList.tsx index 030ccac..6cec694 100644 --- a/src/components/CharacterList/CharacterList.tsx +++ b/src/components/CharacterList/CharacterList.tsx @@ -22,19 +22,21 @@ const CharacterListing = ({char, active, onClick, onEdit, onDelete}: { onClick?: (char: Character) => void, onEdit?: (char: Character) => void, onDelete?: (char: Character) => void, -}): JSX.Element => useMemo(() => ( -
onClick(char))} - > -
{char.name}
- onEdit && onEdit(char))} /> - onDelete && onDelete(char))} /> -
-), [char, active, onClick, onEdit, onDelete]); +}): JSX.Element => useMemo(() => { + const handleClick = useCallback(() => onClick && onClick(char), [onClick, char]); + const handleEdit = useCallback(() => onEdit && onEdit(char), [onEdit, char]); + const handleDelete = useCallback(() => onDelete && onDelete(char), [onDelete, char]); + return ( +
+
{char.name}
+ + +
+ ); +}, [char, active, onClick, onEdit, onDelete]); const CharacterList = (): JSX.Element => { const {chars, currentCharID, convos, currentConvoID} = useAppState(); diff --git a/src/util/store.ts b/src/util/store.ts index a683d8c..f681c3d 100644 --- a/src/util/store.ts +++ b/src/util/store.ts @@ -93,7 +93,7 @@ const loadStore = (): AppState => { const autosave = localStorage.getItem('autosave'); if (autosave) { const parsedAutosave: unknown = JSON.parse(autosave); - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any if (validate(parsedAutosave).length === 0) loadState(defaultStore, parsedAutosave as any); }