Skip to content

Commit

Permalink
Merge pull request #2199 from abilpraju-aot/bugfix/FWF-3601-history-call
Browse files Browse the repository at this point in the history
history call prevention for designer users
  • Loading branch information
arun-s-aot authored Aug 21, 2024
2 parents e58edcb + ad336d5 commit e30b466
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions forms-flow-web/src/components/Form/Item/Edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import SaveAsNewVersionConfirmationModal from "./SaveAsNewVersionConfirmationMod
import LoadingOverlay from "react-loading-overlay-ts";
import RichText from "../RichText/index";
import { Collapse } from 'react-bootstrap';
import userRoles from "../../../constants/permissions";
const reducer = (form, { type, value }) => {
const formCopy = _cloneDeep(form);
switch (type) {
Expand Down Expand Up @@ -77,7 +78,7 @@ const Edit = React.memo(() => {
const formHistory = useSelector((state) => state.formRestore?.formHistory || []);
const version = formHistory[0]?.changeLog?.version;
const prviousData = useSelector((state) => state.process?.formPreviousData);

const { createDesigns } = userRoles();
const applicationCount = useSelector(
(state) => state.process?.applicationCount
);
Expand Down Expand Up @@ -116,7 +117,7 @@ const Edit = React.memo(() => {
};

useEffect(() => {
if (processListData?.parentFormId && !formHistory.length) {
if (createDesigns && processListData?.parentFormId && !formHistory.length) {
getFormHistory(processListData?.parentFormId).then((res) => {
dispatch(setFormHistories(res.data));
}).catch(() => {
Expand Down
2 changes: 1 addition & 1 deletion forms-flow-web/src/components/Form/Item/Preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const Preview = ({handleNext, hideComponents, activeStep}) => {
};

useEffect(()=>{
if(formProcessList?.parentFormId){
if(createDesigns && formProcessList?.parentFormId){
getFormHistory(formProcessList?.parentFormId).then((res) => {
dispatch(setFormHistories(res.data));
})
Expand Down

0 comments on commit e30b466

Please sign in to comment.