Skip to content

Commit 074b194

Browse files
fixes selectedActions
1 parent d83f9af commit 074b194

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/components/CippStandards/CippStandardAccordion.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ const CippStandardAccordion = ({
112112
// eslint-disable-next-line react-hooks/exhaustive-deps
113113
}, [watchedValues, standards, selectedStandards]);
114114

115-
return Object.keys(selectedStandards).map((standardName) => {
115+
return Object.keys(selectedStandards)?.map((standardName) => {
116116
const standard = standards.find((s) => s.name === standardName.split("[")[0]);
117117
if (!standard) return null;
118118

@@ -121,7 +121,12 @@ const CippStandardAccordion = ({
121121
const isConfigured = configuredState[standardName];
122122
const disabledFeatures = standard.disabledFeatures || {};
123123

124-
const selectedActions = _.get(watchedValues, `${standardName}.action`);
124+
let selectedActions = _.get(watchedValues, `${standardName}.action`);
125+
//if selectedActions is not an array, convert it to an array
126+
if (selectedActions && !Array.isArray(selectedActions)) {
127+
selectedActions = [selectedActions];
128+
}
129+
125130
const selectedTemplateName = standard.multiple
126131
? _.get(watchedValues, `${standardName}.${standard.addedComponent?.[0]?.name}`)
127132
: "";

0 commit comments

Comments
 (0)