From 56acc5356138a52e6f1f54659d9ad7ae9a61908f Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 13 Mar 2024 01:15:56 +0700 Subject: [PATCH] fixes --- src/widgets/action-editor/ui/ActionEditor.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/widgets/action-editor/ui/ActionEditor.tsx b/src/widgets/action-editor/ui/ActionEditor.tsx index 5674399..f30a221 100644 --- a/src/widgets/action-editor/ui/ActionEditor.tsx +++ b/src/widgets/action-editor/ui/ActionEditor.tsx @@ -58,13 +58,16 @@ export default function ActionEditor({ onClose, canExit = false, }: ActionEditorProps) { - const [value, setValue] = useState(0); - const [loading, setLoading] = useState(false); - const attachmentType = initialAction ? getActionAttachmentType(initialAction) : "empty"; + const [value, setValue] = useState( + attachmentType === "empty" ? 0 : attachmentType === "image" ? 1 : 2, + ); + + const [loading, setLoading] = useState(false); + const [imageUrl, setImageUrl] = useState( initialAction && attachmentType === "image" ? initialAction.fileUrls[0]! @@ -193,7 +196,7 @@ export default function ActionEditor({ multiline minRows={8} maxRows={8} - value={action.text} + value={action.text ?? ""} onChange={(event) => setAction((currentAction) => ({ ...currentAction,