Skip to content

Commit

Permalink
fix: use correct router
Browse files Browse the repository at this point in the history
Signed-off-by: SuZhou-Joe <[email protected]>
  • Loading branch information
SuZhou-Joe committed Oct 30, 2024
1 parent d4123fa commit 8a638c8
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions public/render_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@

import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter as Router, Route } from 'react-router-dom';
import { HashRouter as Router, Route } from 'react-router-dom';
import { Provider } from 'react-redux';
import { AppMountParameters, CoreStart } from '../../../src/core/public';
import { FlowFrameworkDashboardsApp } from './app';
import { store } from './store';
import { PLUGIN_ID } from '../common';

// styling
import './global-styles.scss';
Expand All @@ -24,7 +23,7 @@ export const renderApp = (
params.element.className = 'stretch-absolute';
ReactDOM.render(
<Provider store={store}>
<Router basename={params.appBasePath + '#/'}>
<Router>
<Route
render={(props) => (
<FlowFrameworkDashboardsApp
Expand All @@ -39,16 +38,8 @@ export const renderApp = (
params.element
);

const EXPECTED_BASE_PATH = `/app/${PLUGIN_ID}#`;

const unlistenParentHistory = params.history.listen(() => {
if (
hideInAppSideNavBar &&
window.location.pathname.endsWith(`/app/${PLUGIN_ID}`)
) {
window.location.href = EXPECTED_BASE_PATH;
window.dispatchEvent(new HashChangeEvent('hashchange'));
}
window.dispatchEvent(new HashChangeEvent('hashchange'));
});

return () => {
Expand Down

0 comments on commit 8a638c8

Please sign in to comment.