From 943e3f6ae37ecc56f21168f057dde77a05e4e144 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Tue, 2 Mar 2021 10:05:59 -0500 Subject: [PATCH] fix(react, vue): tab buttons no longer throw an error if href is undefined (#22998) resolves #22997 --- packages/react-router/src/ReactRouter/IonRouter.tsx | 4 +++- packages/vue-router/src/router.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/react-router/src/ReactRouter/IonRouter.tsx b/packages/react-router/src/ReactRouter/IonRouter.tsx index 50794eafcc..f131145473 100644 --- a/packages/react-router/src/ReactRouter/IonRouter.tsx +++ b/packages/react-router/src/ReactRouter/IonRouter.tsx @@ -76,7 +76,9 @@ class IonRouterInner extends React.PureComponent { }; } - handleChangeTab(tab: string, path: string, routeOptions?: any) { + handleChangeTab(tab: string, path?: string, routeOptions?: any) { + if (!path) { return; } + const routeInfo = this.locationHistory.getCurrentRouteInfoForTab(tab); const [pathname, search] = path.split('?'); if (routeInfo) { diff --git a/packages/vue-router/src/router.ts b/packages/vue-router/src/router.ts index 76aea4c57a..7f939b58c7 100644 --- a/packages/vue-router/src/router.ts +++ b/packages/vue-router/src/router.ts @@ -252,7 +252,9 @@ export const createIonRouter = (opts: IonicVueRouterOptions, router: Router) => } } - const changeTab = (tab: string, path: string) => { + const changeTab = (tab: string, path?: string) => { + if (!path) return; + const routeInfo = locationHistory.getCurrentRouteInfoForTab(tab); const [pathname] = path.split('?');