From af24f6ef56888b1f0faee368054dd44c8ee9f5ae Mon Sep 17 00:00:00 2001 From: Nakul Nagargade <133095394+nakulnagargade@users.noreply.github.com> Date: Mon, 16 Oct 2023 15:37:51 +0530 Subject: [PATCH] Fixes on adding query params in event handler, breaking the app (#7889) * Fix on version change if left sidebar is open canvas not scrolling right * Fix on adding query params in event handler, breaking the app * Fix --- frontend/src/Editor/EditorFunc.jsx | 2 +- .../Editor/Inspector/ActionConfigurationPanels/GotoApp.jsx | 6 ++++-- .../Inspector/ActionConfigurationPanels/SwitchPage.jsx | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/src/Editor/EditorFunc.jsx b/frontend/src/Editor/EditorFunc.jsx index 89931834f3..bc9909cffc 100644 --- a/frontend/src/Editor/EditorFunc.jsx +++ b/frontend/src/Editor/EditorFunc.jsx @@ -256,7 +256,7 @@ const EditorComponent = (props) => { canvasContainerRef.current.scrollLeft += editorMarginLeft; } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [editorMarginLeft]); + }, [editorMarginLeft, canvasContainerRef?.current]); useEffect(() => { if (mounted) { diff --git a/frontend/src/Editor/Inspector/ActionConfigurationPanels/GotoApp.jsx b/frontend/src/Editor/Inspector/ActionConfigurationPanels/GotoApp.jsx index d42ebee133..3c8636d647 100644 --- a/frontend/src/Editor/Inspector/ActionConfigurationPanels/GotoApp.jsx +++ b/frontend/src/Editor/Inspector/ActionConfigurationPanels/GotoApp.jsx @@ -6,8 +6,10 @@ import { useTranslation } from 'react-i18next'; export function GotoApp({ getAllApps, event, handlerChanged, eventIndex, darkMode }) { const queryParamChangeHandler = (index, key, value) => { - event.queryParams[index][key] = value; - handlerChanged(eventIndex, 'queryParams', event.queryParams); + if (event?.queryParams?.[index]?.[key]) { + event.queryParams[index][key] = value; + handlerChanged(eventIndex, 'queryParams', event.queryParams); + } }; const { t } = useTranslation(); diff --git a/frontend/src/Editor/Inspector/ActionConfigurationPanels/SwitchPage.jsx b/frontend/src/Editor/Inspector/ActionConfigurationPanels/SwitchPage.jsx index cd3dffe52e..dc697c4797 100644 --- a/frontend/src/Editor/Inspector/ActionConfigurationPanels/SwitchPage.jsx +++ b/frontend/src/Editor/Inspector/ActionConfigurationPanels/SwitchPage.jsx @@ -69,7 +69,7 @@ export function SwitchPage({ getPages, event, handlerChanged, eventIndex, darkMo