From 20cb8ee2216487286b5f85ba81689434c5f5e2a0 Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Fri, 13 Sep 2024 14:20:45 +0530 Subject: [PATCH] skip parent is section check; coz why not detail be present outside section too --- src/Components/LogUpdate/CriticalCarePreview.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Components/LogUpdate/CriticalCarePreview.tsx b/src/Components/LogUpdate/CriticalCarePreview.tsx index 0f33bdfe7af..23efc98028f 100644 --- a/src/Components/LogUpdate/CriticalCarePreview.tsx +++ b/src/Components/LogUpdate/CriticalCarePreview.tsx @@ -555,17 +555,13 @@ const Detail = (props: { }) => { const context = React.useContext(sectionContext); - if (context === null) { - throw "This component must be used as a descendant of Section component only"; - } - let value = props.value; value = value === "" ? null : value; value = value === true ? "Yes" : value; value = value === false ? "No" : value; React.useEffect(() => { - if (value != null) { + if (context && value != null) { context.hasValue(); } }, [context, value]);