ui-soxo-bootstrap-core 2.6.55-dev.1 → 2.6.55-dev.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useContext, useEffect, useRef, useState } from 'react';
|
|
1
|
+
import { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { Route, Switch } from 'react-router-dom';
|
|
4
4
|
|
|
@@ -44,8 +44,34 @@ function getRandomMessage(previousMessage = '') {
|
|
|
44
44
|
* @param {*} param0
|
|
45
45
|
* @returns
|
|
46
46
|
*/
|
|
47
|
-
export default function LandingApi({ history, CustomComponents, CustomModels, appSettings, transitionPending = false, onHomeReady, ...props }) {
|
|
47
|
+
export default function LandingApi({ history, CustomComponents, CustomModels, appSettings: baseAppSettings, transitionPending = false, onHomeReady, ...props }) {
|
|
48
48
|
const [loader, setLoader] = useState(false);
|
|
49
|
+
|
|
50
|
+
// Active db pointer, kept in sync with branch switches
|
|
51
|
+
const [activeDbPtr, setActiveDbPtr] = useState(() => localStorage.getItem('db_ptr'));
|
|
52
|
+
|
|
53
|
+
// App settings with headers.db_ptr reflecting the active branch
|
|
54
|
+
const appSettings = useMemo(() => {
|
|
55
|
+
if (!activeDbPtr) return baseAppSettings;
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
...baseAppSettings,
|
|
59
|
+
headers: {
|
|
60
|
+
...(baseAppSettings?.headers || {}),
|
|
61
|
+
db_ptr: activeDbPtr,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}, [baseAppSettings, activeDbPtr]);
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
const handleBranchChanged = (event) => {
|
|
68
|
+
setActiveDbPtr(event.detail || localStorage.getItem('db_ptr'));
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
window.addEventListener('branchChanged', handleBranchChanged);
|
|
72
|
+
|
|
73
|
+
return () => window.removeEventListener('branchChanged', handleBranchChanged);
|
|
74
|
+
}, []);
|
|
49
75
|
// const [modules, setModules] = useState([]);
|
|
50
76
|
|
|
51
77
|
const [connected] = useState();
|