Skip to content

Commit

Permalink
Merge pull request #2473 from arun-s-aot/bugfix/FWF-4114-unsaved-moda…
Browse files Browse the repository at this point in the history
…l-open-issue

FWF-4020 [Bugfix] Unsaved changes issue for new form create without save fixed
  • Loading branch information
arun-s-aot authored Jan 1, 2025
2 parents a1aa12c + f20da51 commit 8045c62
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions forms-flow-web/src/components/Form/List.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -204,7 +203,7 @@ const List = React.memo((props) => {
}

} else if (formId) {
dispatch(push(`${redirectUrl}formflow/${formId}/edit/`));
navigateToDesignFormEdit(dispatch,tenantKey,formId);
}
} catch (err) {
setImportLoader(false);
Expand Down Expand Up @@ -275,8 +274,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) {
Expand Down

0 comments on commit 8045c62

Please sign in to comment.