Skip to content

Commit

Permalink
Fix Side Nav URL behavior with NewHomePage enabled (#312) (#315)
Browse files Browse the repository at this point in the history
Signed-off-by: saimedhi <saimedhi@amazon.com>
(cherry picked from commit c8faaf7)

Co-authored-by: Sai Medhini Reddy Maryada <117196660+saimedhi@users.noreply.github.com>
  • Loading branch information
opensearch-trigger-bot[bot] and saimedhi authored Aug 27, 2024
1 parent 54c8aef commit 565c721
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion public/render_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,20 @@ export const renderApp = (
params.element
);

return () => ReactDOM.unmountComponentAtNode(params.element);
const expectedBasePath = '/app/flow-framework#';

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

return () => {
ReactDOM.unmountComponentAtNode(params.element);
unlistenParentHistory();
};
};

0 comments on commit 565c721

Please sign in to comment.