refactor: IonRouter defaultHref assignment

This commit is contained in:
Sean Perkins
2023-06-30 16:12:09 -04:00
parent 7d8204a0a7
commit 9bef17d9c8

View File

@@ -209,7 +209,11 @@ function IonRouterInner(props: PropsWithChildren<any>) {
const handleNavigateBack = (defaultHref: string | RouteInfo = '/', routeAnimation?: AnimationBuilder) => {
const config = getConfig();
defaultHref = defaultHref ? defaultHref : config && config.get('backButtonDefaultHref' as any);
if (!defaultHref && config) {
// If the defaultHref wasn't passed in, then we should use the configured defaultHref.
// Developers can set this on their IonicConfig.
defaultHref = config.get('backButtonDefaultHref');
}
const routeInfo = locationHistory.current.current();
if (routeInfo && routeInfo.pushedByRoute) {