diff --git a/src/components/FormField/components/Table/index.js b/src/components/FormField/components/Table/index.js index d02badb..5d80b09 100644 --- a/src/components/FormField/components/Table/index.js +++ b/src/components/FormField/components/Table/index.js @@ -136,7 +136,8 @@ const Table = ({ return ( <> {rows ? : null} {!isEmpty(columns) && !shouldDisableNewRows diff --git a/src/helpers/renderHtmlContent.js b/src/helpers/renderHtmlContent.js index 8a59d21..61f176f 100644 --- a/src/helpers/renderHtmlContent.js +++ b/src/helpers/renderHtmlContent.js @@ -1,5 +1,5 @@ import parse from 'html-react-parser'; -const renderHtmlContent = (content) => parse(content); +const renderHtmlContent = (content = '') => parse(content); export default renderHtmlContent; \ No newline at end of file diff --git a/src/helpers/validators.js b/src/helpers/validators.js index e4f9aff..3a05435 100644 --- a/src/helpers/validators.js +++ b/src/helpers/validators.js @@ -68,7 +68,6 @@ export const maxChecks = (v, num) => { } export const nonEmptyTables = (v = [], tableCfg = []) => { - //console.log('nonEmptyTables',v) const colsCfg = pathOr([], ['stateFieldData'], tableCfg); const nonPredefinedCells = colsCfg .filter(o => !o.predefined) @@ -76,22 +75,24 @@ export const nonEmptyTables = (v = [], tableCfg = []) => { let isTableValid = true; let atLeastOneCellFilled = false - // eslint-disable-next-line array-callback-return - v.map((row) => { - if (isEmpty(row)) { - isTableValid = false; - } else { - // eslint-disable-next-line array-callback-return - nonPredefinedCells.map((k) => { - if (isNil(row[k]) || isEmpty(row[k])) { - isTableValid = atLeastOneCellFilled; - } else { - atLeastOneCellFilled = true; - isTableValid = true; - } - }); - } - }); + if (is(Array, v)) { + // eslint-disable-next-line array-callback-return + v.map((row) => { + if (isEmpty(row)) { + isTableValid = false; + } else { + // eslint-disable-next-line array-callback-return + nonPredefinedCells.map((k) => { + if (isNil(row[k]) || isEmpty(row[k])) { + isTableValid = atLeastOneCellFilled; + } else { + atLeastOneCellFilled = true; + isTableValid = true; + } + }); + } + }); + } return is(Array, v) ? v.length >= 1 && isTableValid : false; } \ No newline at end of file diff --git a/src/pages/BandoApplication/index.js b/src/pages/BandoApplication/index.js index 9272991..bdbf0bd 100644 --- a/src/pages/BandoApplication/index.js +++ b/src/pages/BandoApplication/index.js @@ -96,7 +96,7 @@ const BandoApplication = () => { const submitApplicationCallback = (data) => { if (data.status === 'SUCCESS') { - if (data.data.applicationStatus) { + if (data.data.status) { setApplicationStatus(data.data.status); // ask why not 'applicationStatus'? } } @@ -394,7 +394,7 @@ const BandoApplication = () => { useEffect(() => { if (formInitialData) { - reset(); + //reset(); Object.keys(formInitialData).map(k => setValue(k, formInitialData[k])) } }, [formInitialData]); @@ -483,6 +483,7 @@ const BandoApplication = () => { return acc; }, {}); + //console.log('validations', validations, o.name) return ['paragraph'].includes(o.name) && text ?
{renderHtmlContent(text.value)}