From 49332e4e68c073628700e784d728a12ecfb64b61 Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 13 Mar 2024 01:11:49 +0700 Subject: [PATCH] fixes --- src/widgets/chain-editor/ui/ChainEditor.tsx | 23 +++++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/widgets/chain-editor/ui/ChainEditor.tsx b/src/widgets/chain-editor/ui/ChainEditor.tsx index 020e835..9824e0c 100644 --- a/src/widgets/chain-editor/ui/ChainEditor.tsx +++ b/src/widgets/chain-editor/ui/ChainEditor.tsx @@ -58,6 +58,7 @@ export default function ChainEditor({ chain }: ChainEditorProps) {
- actionsListRef.current?.scrollTo({ - behavior: "smooth", - top: actionsListRef.current.scrollHeight, - }), - 0, - ); + if (addingNewAction) { + setTimeout( + () => + actionsListRef.current?.scrollTo({ + behavior: "smooth", + top: actionsListRef.current.scrollHeight, + }), + 0, + ); + } }} onClose={() => { if (addingNewAction) setAddingNewAction(false); @@ -120,7 +123,9 @@ export default function ChainEditor({ chain }: ChainEditorProps) { chain={chain} action={action} actionIndex={index} - onEdit={setActionToEdit} + onEdit={(actionIndex) => { + setActionToEdit(actionIndex); + }} /> ))}