@visns-studio/visns-components 5.26.4 → 5.26.5
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.
|
|
97
|
+
"version": "5.26.5",
|
|
98
98
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
99
99
|
"main": "src/index.js",
|
|
100
100
|
"files": [
|
|
@@ -569,7 +569,6 @@ function GenericDashboard({ setting, userProfile, dynamicDashboard = false }) {
|
|
|
569
569
|
const swapy = useRef(null);
|
|
570
570
|
const container = useRef(null);
|
|
571
571
|
const navigate = useNavigate();
|
|
572
|
-
const initialLoadRef = useRef(true); // Ref to track initial load
|
|
573
572
|
const [dashboardSetting, setDashboardSetting] = useState(() =>
|
|
574
573
|
dedupeWidgets(
|
|
575
574
|
dynamicDashboard ? userProfile.dashboard_setting || setting : setting
|
|
@@ -721,42 +720,14 @@ function GenericDashboard({ setting, userProfile, dynamicDashboard = false }) {
|
|
|
721
720
|
}
|
|
722
721
|
};
|
|
723
722
|
|
|
724
|
-
// Single
|
|
723
|
+
// Single fetch trigger: filters are (re)built whenever dashboardSetting
|
|
724
|
+
// changes, so every load path funnels through this one effect — the old
|
|
725
|
+
// split effects fired twice per mount (every widget fetched twice).
|
|
725
726
|
useEffect(() => {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
// Fetch data once with initial filters
|
|
729
|
-
fetchData(filters);
|
|
730
|
-
// Mark initial load as complete
|
|
731
|
-
initialLoadRef.current = false;
|
|
732
|
-
}
|
|
733
|
-
}, [filters]);
|
|
734
|
-
|
|
735
|
-
// Handle filter changes after initial load
|
|
736
|
-
const isInitialFilterChangeRef = useRef(true);
|
|
737
|
-
|
|
738
|
-
useEffect(() => {
|
|
739
|
-
// Skip the first filter change (which happens during initialization)
|
|
740
|
-
if (isInitialFilterChangeRef.current) {
|
|
741
|
-
isInitialFilterChangeRef.current = false;
|
|
742
|
-
return;
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
// Only fetch data if filters have been initialized
|
|
746
|
-
if (!initialLoadRef.current && Object.keys(filters).length > 0) {
|
|
747
|
-
fetchData(filters);
|
|
748
|
-
}
|
|
727
|
+
if (Object.keys(filters).length === 0) return;
|
|
728
|
+
fetchData(filters);
|
|
749
729
|
}, [filters]);
|
|
750
730
|
|
|
751
|
-
// Handle dashboardSetting changes
|
|
752
|
-
useEffect(() => {
|
|
753
|
-
// Skip the initial render
|
|
754
|
-
if (!initialLoadRef.current) {
|
|
755
|
-
// Only fetch data if it's not the initial load
|
|
756
|
-
fetchData(filters);
|
|
757
|
-
}
|
|
758
|
-
}, [dashboardSetting]);
|
|
759
|
-
|
|
760
731
|
// Handle window resize events to update viewportWidth
|
|
761
732
|
useEffect(() => {
|
|
762
733
|
const handleResize = () => {
|