From 1ecfb100465d612d176dc6e922dcf965e6b6eeb3 Mon Sep 17 00:00:00 2001 From: Arun S Date: Wed, 1 Jan 2025 16:07:53 +0530 Subject: [PATCH 1/2] FWF-4020 [Bugfix] Unsaved changes issue for new form create without save fixed --- forms-flow-web/src/components/Form/List.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/forms-flow-web/src/components/Form/List.js b/forms-flow-web/src/components/Form/List.js index 37820d511..8f387ae3c 100644 --- a/forms-flow-web/src/components/Form/List.js +++ b/forms-flow-web/src/components/Form/List.js @@ -1,7 +1,6 @@ import React, { useEffect, useState } from "react"; import { connect, useSelector, useDispatch } from "react-redux"; import CreateFormModal from "../Modals/CreateFormModal.js"; -import { push } from "connected-react-router"; import { toast } from "react-toastify"; import { addTenantkey } from "../../helper/helper"; import { selectRoot, selectError, Errors, deleteForm } from "@aot-technologies/formio-react"; @@ -38,6 +37,7 @@ import FileService from "../../services/FileService"; import { FormBuilderModal, ImportModal, CustomSearch, CustomButton } from "@formsflow/components"; import { useMutation } from "react-query"; import { addHiddenApplicationComponent } from "../../constants/applicationComponent"; +import { navigateToDesignFormEdit } from "../../helper/routerHelper.js"; const List = React.memo((props) => { const { createDesigns, createSubmissions, viewDesigns } = userRoles(); @@ -204,7 +204,7 @@ const List = React.memo((props) => { } } else if (formId) { - dispatch(push(`${redirectUrl}formflow/${formId}/edit/`)); + navigateToDesignFormEdit(dispatch,tenantKey,formId); } } catch (err) { setImportLoader(false); @@ -275,8 +275,7 @@ const List = React.memo((props) => { formCreate(newForm).then((res) => { const form = res.data; dispatch(setFormSuccessData("form", form)); - dispatch(push(`${redirectUrl}formflow/${form._id}/edit/`)); - + navigateToDesignFormEdit(dispatch,tenantKey,form._id); }).catch((err) => { let error; if (err.response?.data) { From f20da516a15d537145690ddb288e87b1812cccb3 Mon Sep 17 00:00:00 2001 From: Arun S Date: Wed, 1 Jan 2025 17:27:06 +0530 Subject: [PATCH 2/2] [Bugfix] Sonarcloud fix --- forms-flow-web/src/components/Form/List.js | 1 - 1 file changed, 1 deletion(-) diff --git a/forms-flow-web/src/components/Form/List.js b/forms-flow-web/src/components/Form/List.js index 8f387ae3c..bff9d5616 100644 --- a/forms-flow-web/src/components/Form/List.js +++ b/forms-flow-web/src/components/Form/List.js @@ -62,7 +62,6 @@ const List = React.memo((props) => { // const [formDescription, setFormDescription] = useState(""); const [nameError, setNameError] = useState(""); const dispatch = useDispatch(); - const redirectUrl = MULTITENANCY_ENABLED ? `/tenant/${tenantKey}/` : "/"; const submissionAccess = useSelector((state) => state.user?.submissionAccess || []); const [formSubmitted, setFormSubmitted] = useState(false);