From 747ef8daee5fc804350849834cfed5ab66f5e0b0 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Fri, 10 Dec 2021 09:07:07 -0500 Subject: [PATCH] Special case goBack to navigate to catalog if no where to go back to (#4544) --- src/renderer/components/layout/setting-layout.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/renderer/components/layout/setting-layout.tsx b/src/renderer/components/layout/setting-layout.tsx index 9f458658e8..282eed0dcb 100644 --- a/src/renderer/components/layout/setting-layout.tsx +++ b/src/renderer/components/layout/setting-layout.tsx @@ -26,6 +26,7 @@ import { observer } from "mobx-react"; import { cssNames, IClassName } from "../../utils"; import { navigation } from "../../navigation"; import { Icon } from "../icon"; +import { catalogURL } from "../../../common/routes"; export interface SettingLayoutProps extends React.DOMAttributes { className?: IClassName; @@ -39,7 +40,13 @@ export interface SettingLayoutProps extends React.DOMAttributes { const defaultProps: Partial = { provideBackButtonNavigation: true, contentGaps: true, - back: () => navigation.goBack(), + back: () => { + if (navigation.length <= 1) { + navigation.push(catalogURL()); + } else { + navigation.goBack(); + } + }, }; /**