l-min-components 1.0.617 → 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
|
@@ -52,6 +52,7 @@ const HeaderComponent = (props) => {
|
|
|
52
52
|
const { pathname } = useLocation();
|
|
53
53
|
const { setGeneralData, generalData } = useContext(OutletContext);
|
|
54
54
|
const [selectedAccount, setSelectedAccount] = useState();
|
|
55
|
+
const prevAccountRef = useRef();
|
|
55
56
|
|
|
56
57
|
useEffect(() => {
|
|
57
58
|
setIsOpen(false);
|
|
@@ -59,6 +60,23 @@ const HeaderComponent = (props) => {
|
|
|
59
60
|
handleGetUserDetails();
|
|
60
61
|
handleGetDefaultAccount();
|
|
61
62
|
}, []);
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
// Initial set to avoid undefined comparisons
|
|
66
|
+
prevAccountRef.current = selectedAccount;
|
|
67
|
+
}, []);
|
|
68
|
+
|
|
69
|
+
// Reload when another account is selected
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
const shouldReload = selectedAccount && selectedAccount !== prevAccountRef.current;
|
|
72
|
+
if (shouldReload) {
|
|
73
|
+
// Make sure any necessary conditions are met before reloading
|
|
74
|
+
window.location.reload();
|
|
75
|
+
}
|
|
76
|
+
prevAccountRef.current = selectedAccount;
|
|
77
|
+
}, [selectedAccount]);
|
|
78
|
+
|
|
79
|
+
|
|
62
80
|
useEffect(() => {
|
|
63
81
|
if (userAccountsDetail?.data) {
|
|
64
82
|
setGeneralData((generalData) => ({
|
|
@@ -148,15 +166,6 @@ const HeaderComponent = (props) => {
|
|
|
148
166
|
}));
|
|
149
167
|
}
|
|
150
168
|
}, [selectedAccount])
|
|
151
|
-
|
|
152
|
-
useEffect(()=>{
|
|
153
|
-
if(selectedAccount){
|
|
154
|
-
setGeneralData((generalData) => ({
|
|
155
|
-
...generalData,
|
|
156
|
-
defaultAccount: getDefaultAccount?.data,
|
|
157
|
-
}));
|
|
158
|
-
}
|
|
159
|
-
}, [getDefaultAccount?.response])
|
|
160
169
|
|
|
161
170
|
const containerRef = useRef(null);
|
|
162
171
|
const secondContainerRef = useRef(null);
|
|
@@ -71,18 +71,18 @@ const SideMenu = ({
|
|
|
71
71
|
console.log(window.location.pathname, "pathname");
|
|
72
72
|
// checking developer account routes
|
|
73
73
|
if (
|
|
74
|
-
(window.location.pathname.includes("api") && path === "/") ||
|
|
75
|
-
(window.location.pathname === "/" && path === "/")
|
|
74
|
+
(window.location.pathname.includes("api") && path === "/developer") ||
|
|
75
|
+
(window.location.pathname === "/" && path === "/developer")
|
|
76
76
|
) {
|
|
77
77
|
return (statusText = true);
|
|
78
78
|
}
|
|
79
79
|
if (
|
|
80
80
|
window.location.pathname.includes("documentation") &&
|
|
81
|
-
path === "/documentation"
|
|
81
|
+
path === "/developer/documentation"
|
|
82
82
|
) {
|
|
83
83
|
return (statusText = true);
|
|
84
84
|
}
|
|
85
|
-
if (window.location.pathname.includes("report") && path === "/report") {
|
|
85
|
+
if (window.location.pathname.includes("developer/report") && path === "/developer/report") {
|
|
86
86
|
return (statusText = true);
|
|
87
87
|
}
|
|
88
88
|
|