diff --git a/package-lock.json b/package-lock.json index 91aa154..1237443 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@indec/form-builder", - "version": "5.0.5", + "version": "5.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@indec/form-builder", - "version": "5.0.5", + "version": "5.1.0", "license": "ISC", "dependencies": { "@storybook/test": "^8.4.7", diff --git a/package.json b/package.json index 8e04cba..661489c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@indec/form-builder", - "version": "5.0.5", + "version": "5.1.0", "description": "Form builder", "main": "index.js", "private": false, diff --git a/src/components/QuestionBuilder/Question/Question.js b/src/components/QuestionBuilder/Question/Question.js index 01024a9..599f031 100644 --- a/src/components/QuestionBuilder/Question/Question.js +++ b/src/components/QuestionBuilder/Question/Question.js @@ -33,7 +33,7 @@ function Question({sectionIndex, questionIndex, disabled = false, warnings = {}, } useEffect(() => { - if (shouldClean && !question.readOnly && !isInHeader) { + if (shouldClean && !question.readOnly && !isInHeader && !question.hide) { const defaultAnswerValue = buildQuestions(section)[section.name][0][question.name].answer; setFieldValue(questionName, defaultAnswerValue); shouldClean = false; @@ -41,11 +41,13 @@ function Question({sectionIndex, questionIndex, disabled = false, warnings = {}, }, [shouldClean, questionName, isInHeader]); const Component = getQuestionComponent(questionType); - return Component ? ( - - ) : ( -

Invalid component.

- ); + if (Component && !question.hide) { + return ; + } + if (!Component) { + return

Invalid component.

; + } + return null; } export default Question;