diff --git a/src/components/encounter/ohri-encounter-form.tsx b/src/components/encounter/ohri-encounter-form.tsx index 7202e5d69..b0ed31af5 100644 --- a/src/components/encounter/ohri-encounter-form.tsx +++ b/src/components/encounter/ohri-encounter-form.tsx @@ -556,9 +556,15 @@ export const OHRIEncounterForm: React.FC = ({ }}> {form.pages.map((page, index) => { - if (isTrue(page.isHidden)) { + const pageHasNoVisibleContent = + page.sections.every(section => section.isHidden) || + page.sections.every(section => section.questions.every(question => question.isHidden)) || + isTrue(page.isHidden); + + if (pageHasNoVisibleContent) { return null; } + if (isTrue(page.isSubform) && page.subform?.form) { if (sessionMode != 'enter' && !page.subform?.form.encounter) { return null; diff --git a/src/components/page/ohri-form-page.tsx b/src/components/page/ohri-form-page.tsx index 9e6c578b1..cc4ae9b03 100644 --- a/src/components/page/ohri-form-page.tsx +++ b/src/components/page/ohri-form-page.tsx @@ -12,14 +12,6 @@ function OHRIFormPage({ page, onFieldChange, setSelectedPage, isCollapsed }) { setSelectedPage(elementID); }; - const pageHasNoVisibleQuestions = page.sections.every(section => - section.questions.every(question => question.isHidden), - ); - - if (pageHasNoVisibleQuestions) { - console.info(`The page "${page.label}" has no visible questions. Its sections will not be rendered.`); - } - const visibleSections = page.sections.filter(section => { const hasVisibleQuestions = section.questions.some(question => !isTrue(question.isHidden)); return !isTrue(section.isHidden) && hasVisibleQuestions;