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
This commit is contained in:
Nakul Nagargade 2023-10-16 15:37:51 +05:30 committed by GitHub
parent f94b49e180
commit af24f6ef56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View file

@ -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) {

View file

@ -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();

View file

@ -69,7 +69,7 @@ export function SwitchPage({ getPages, event, handlerChanged, eventIndex, darkMo
<div key={index} className="row input-group mt-1">
<div className="col">
<CodeHinter
initialValue={event.queryParams[index][0]}
initialValue={event?.queryParams?.[index]?.[0]}
onChange={(value) => queryParamChangeHandler(index, 0, value)}
mode="javascript"
className="form-control codehinter-query-editor-input"
@ -79,7 +79,7 @@ export function SwitchPage({ getPages, event, handlerChanged, eventIndex, darkMo
</div>
<div className="col">
<CodeHinter
initialValue={event.queryParams[index][1]}
initialValue={event?.queryParams?.[index]?.[1]}
onChange={(value) => queryParamChangeHandler(index, 1, value)}
mode="javascript"
className="form-control codehinter-query-editor-input"