@visns-studio/visns-components 5.26.2 → 5.26.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
@@ -94,7 +94,7 @@
94
94
  "react-dom": "^17.0.0 || ^18.0.0"
95
95
  },
96
96
  "name": "@visns-studio/visns-components",
97
- "version": "5.26.2",
97
+ "version": "5.26.3",
98
98
  "description": "Various packages to assist in the development of our Custom Applications.",
99
99
  "main": "src/index.js",
100
100
  "files": [
@@ -662,19 +662,31 @@ function GenericDashboard({ setting, userProfile, dynamicDashboard = false }) {
662
662
  return null;
663
663
  });
664
664
 
665
- const results = await Promise.all(promises);
665
+ // allSettled: one failed widget request must not blank the whole
666
+ // dashboard — failed widgets stay empty, the rest still render.
667
+ const results = await Promise.allSettled(promises);
666
668
 
667
669
  const fetchedData = dashboardSetting.widgets.reduce(
668
670
  (acc, widget, index) => {
669
- if (results[index]) {
671
+ const result = results[index];
672
+
673
+ if (result.status === 'rejected') {
674
+ console.error(
675
+ `Error fetching data for widget ${widget.id}:`,
676
+ result.reason
677
+ );
678
+ return acc;
679
+ }
680
+
681
+ if (result.value) {
670
682
  // Check if the response indicates an error
671
- if (results[index]?.data?.value) {
683
+ if (result.value?.data?.value) {
672
684
  console.error(
673
685
  `API error for widget ${widget.id}:`,
674
- results[index].data.value
686
+ result.value.data.value
675
687
  );
676
688
  } else {
677
- acc[widget.id] = results[index]?.data;
689
+ acc[widget.id] = result.value?.data;
678
690
  }
679
691
  }
680
692
  return acc;