@visns-studio/visns-components 5.4.2 → 5.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "fabric": "^6.5.4",
20
20
  "file-saver": "^2.0.5",
21
21
  "framer-motion": "^11.18.2",
22
- "html-react-parser": "^5.2.2",
22
+ "html-react-parser": "^5.2.3",
23
23
  "lodash": "^4.17.21",
24
24
  "lodash.debounce": "^4.0.8",
25
25
  "moment": "^2.30.1",
@@ -78,7 +78,7 @@
78
78
  "react-dom": "^17.0.0 || ^18.0.0"
79
79
  },
80
80
  "name": "@visns-studio/visns-components",
81
- "version": "5.4.2",
81
+ "version": "5.4.3",
82
82
  "description": "Various packages to assist in the development of our Custom Applications.",
83
83
  "main": "src/index.js",
84
84
  "files": [
@@ -713,10 +713,33 @@ const GenericDynamic = ({
713
713
  setActiveFormKey(0);
714
714
  }
715
715
  } else {
716
- const activeFormData =
717
- data[type].length > 0 && Array.isArray(data[type])
718
- ? data[type][0]
719
- : data[type];
716
+ let activeFormData;
717
+
718
+ if (Array.isArray(data[type])) {
719
+ console.info('a');
720
+ // Check if this is an array of fields or an array of arrays of fields
721
+ if (data[type].length > 0) {
722
+ // Check if the first item has field properties or is itself an array of fields
723
+ const firstItem = data[type][0];
724
+ if (
725
+ Array.isArray(firstItem) ||
726
+ (typeof firstItem === 'object' &&
727
+ firstItem !== null &&
728
+ (firstItem.hasOwnProperty('id') ||
729
+ firstItem.hasOwnProperty('type')))
730
+ ) {
731
+ activeFormData = data[type];
732
+ } else {
733
+ activeFormData = data[type][0];
734
+ }
735
+ } else {
736
+ // Empty array, use as is
737
+ activeFormData = data[type];
738
+ }
739
+ } else {
740
+ // Not an array, use as is
741
+ activeFormData = data[type];
742
+ }
720
743
 
721
744
  setActiveForm(activeFormData);
722
745
  setActiveFormKey(0);