Просмотр исходного кода

Fix crash in Wizard's options page

There may be a case where an object field may have its "properties" as a
non-array type. So instead of testing the length of that properties
field we can test the availability of the "filter" function.
Sergiu Miclea 7 лет назад
Родитель
Сommit
f3b37913c2
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      src/components/organisms/WizardPageContent/WizardPageContent.jsx

+ 1 - 1
src/components/organisms/WizardPageContent/WizardPageContent.jsx

@@ -213,7 +213,7 @@ class WizardPageContent extends React.Component<Props, State> {
     if (schema && schema.length > 0) {
       let required = schema.filter(f => f.required && f.type !== 'object')
       schema.forEach(f => {
-        if (f.type === 'object' && f.properties && f.properties.length && f.properties.filter(p => isValid(p)).length > 0) {
+        if (f.type === 'object' && f.properties && f.properties.filter && f.properties.filter(p => isValid(p)).length > 0) {
           required = required.concat(f.properties.filter(p => p.required))
         }
       })