[Fleet] Sync hash history with Kibana scoped history (#102523)
This commit is contained in:
parent
dc5972cc4a
commit
b8153946c7
2 changed files with 23 additions and 0 deletions
|
@ -206,6 +206,17 @@ export const FleetAppContext: React.FC<{
|
|||
({ children, startServices, config, history, kibanaVersion, extensions, routerHistory }) => {
|
||||
const isDarkMode = useObservable<boolean>(startServices.uiSettings.get$('theme:darkMode'));
|
||||
const [routerHistoryInstance] = useState(routerHistory || createHashHistory());
|
||||
// Sync our hash history with Kibana scoped history
|
||||
useEffect(() => {
|
||||
const unlistenParentHistory = history.listen(() => {
|
||||
const newHash = createHashHistory();
|
||||
if (newHash.location.pathname !== routerHistoryInstance.location.pathname) {
|
||||
routerHistoryInstance.replace(newHash.location.pathname);
|
||||
}
|
||||
});
|
||||
|
||||
return unlistenParentHistory;
|
||||
}, [history, routerHistoryInstance]);
|
||||
|
||||
return (
|
||||
<startServices.i18n.Context>
|
||||
|
|
|
@ -191,6 +191,18 @@ export const IntegrationsAppContext: React.FC<{
|
|||
const isDarkMode = useObservable<boolean>(startServices.uiSettings.get$('theme:darkMode'));
|
||||
const [routerHistoryInstance] = useState(routerHistory || createHashHistory());
|
||||
|
||||
// Sync our hash history with Kibana scoped history
|
||||
useEffect(() => {
|
||||
const unlistenParentHistory = history.listen(() => {
|
||||
const newHash = createHashHistory();
|
||||
if (newHash.location.pathname !== routerHistoryInstance.location.pathname) {
|
||||
routerHistoryInstance.replace(newHash.location.pathname);
|
||||
}
|
||||
});
|
||||
|
||||
return unlistenParentHistory;
|
||||
}, [history, routerHistoryInstance]);
|
||||
|
||||
return (
|
||||
<startServices.i18n.Context>
|
||||
<KibanaContextProvider services={{ ...startServices }}>
|
||||
|
|
Loading…
Reference in a new issue