fix(react, vue): tab buttons no longer throw an error if href is undefined (#22998)

resolves #22997
This commit is contained in:
Liam DeBeasi
2021-03-02 10:05:59 -05:00
committed by GitHub
parent 9282aa6871
commit 943e3f6ae3
2 changed files with 6 additions and 2 deletions

View File

@ -76,7 +76,9 @@ class IonRouterInner extends React.PureComponent<IonRouteProps, IonRouteState> {
}; };
} }
handleChangeTab(tab: string, path: string, routeOptions?: any) { handleChangeTab(tab: string, path?: string, routeOptions?: any) {
if (!path) { return; }
const routeInfo = this.locationHistory.getCurrentRouteInfoForTab(tab); const routeInfo = this.locationHistory.getCurrentRouteInfoForTab(tab);
const [pathname, search] = path.split('?'); const [pathname, search] = path.split('?');
if (routeInfo) { if (routeInfo) {

View File

@ -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 routeInfo = locationHistory.getCurrentRouteInfoForTab(tab);
const [pathname] = path.split('?'); const [pathname] = path.split('?');