l-min-components 1.0.620 → 1.0.623

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "l-min-components",
3
- "version": "1.0.620",
3
+ "version": "1.0.623",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -61,13 +61,21 @@ const HeaderComponent = (props) => {
61
61
  handleGetDefaultAccount();
62
62
  }, []);
63
63
 
64
+ useEffect(() => {
65
+ // Initial set to avoid undefined comparisons
66
+ prevAccountRef.current = selectedAccount;
67
+ }, []);
68
+
64
69
  // Reload when another account is selected
65
70
  useEffect(() => {
66
- if (selectedAccount && selectedAccount !== prevAccountRef.current) {
71
+ const shouldReload = selectedAccount && selectedAccount !== prevAccountRef.current;
72
+ if (shouldReload) {
73
+ // Make sure any necessary conditions are met before reloading
67
74
  window.location.reload();
68
75
  }
69
76
  prevAccountRef.current = selectedAccount;
70
- }, [selectedAccount]);
77
+ }, [selectedAccount]);
78
+
71
79
 
72
80
  useEffect(() => {
73
81
  if (userAccountsDetail?.data) {
@@ -158,15 +166,6 @@ const HeaderComponent = (props) => {
158
166
  }));
159
167
  }
160
168
  }, [selectedAccount])
161
-
162
- useEffect(()=>{
163
- if(selectedAccount){
164
- setGeneralData((generalData) => ({
165
- ...generalData,
166
- defaultAccount: getDefaultAccount?.data,
167
- }));
168
- }
169
- }, [getDefaultAccount?.response])
170
169
 
171
170
  const containerRef = useRef(null);
172
171
  const secondContainerRef = useRef(null);