refactor(vue): remove support for child routes nested inside of tabs (#22919)

BREAKING CHANGE: Support for child routes nested inside of tabs has been removed to better conform to Vue Router's best practices. Additional routes should be written as sibling routes with the parent tab as the path prefix.
This commit is contained in:
Liam DeBeasi
2021-02-12 14:43:29 -05:00
committed by GitHub
parent 9e05891736
commit 75458ac7fb
7 changed files with 105 additions and 96 deletions

View File

@ -22,16 +22,16 @@ export const createViewStacks = (router: Router) => {
viewItem.ionRoute = true;
}
const findViewItemByRouteInfo = (routeInfo: RouteInfo, outletId?: number, useDeprecatedRouteSetup: boolean = false) => {
return findViewItemByPath(routeInfo.pathname, outletId, false, useDeprecatedRouteSetup);
const findViewItemByRouteInfo = (routeInfo: RouteInfo, outletId?: number) => {
return findViewItemByPath(routeInfo.pathname, outletId, false);
}
const findLeavingViewItemByRouteInfo = (routeInfo: RouteInfo, outletId?: number, mustBeIonRoute: boolean = true, useDeprecatedRouteSetup: boolean = false) => {
return findViewItemByPath(routeInfo.lastPathname, outletId, mustBeIonRoute, useDeprecatedRouteSetup);
const findLeavingViewItemByRouteInfo = (routeInfo: RouteInfo, outletId?: number, mustBeIonRoute: boolean = true) => {
return findViewItemByPath(routeInfo.lastPathname, outletId, mustBeIonRoute);
}
const findViewItemByPathname = (pathname: string, outletId?: number, useDeprecatedRouteSetup: boolean = false) => {
return findViewItemByPath(pathname, outletId, false, useDeprecatedRouteSetup);
const findViewItemByPathname = (pathname: string, outletId?: number) => {
return findViewItemByPath(pathname, outletId, false);
}
const findViewItemInStack = (path: string, stack: ViewItem[]): ViewItem | undefined => {
@ -44,7 +44,7 @@ export const createViewStacks = (router: Router) => {
})
}
const findViewItemByPath = (path: string, outletId?: number, mustBeIonRoute: boolean = false, useDeprecatedRouteSetup: boolean = false): ViewItem | undefined => {
const findViewItemByPath = (path: string, outletId?: number, mustBeIonRoute: boolean = false): ViewItem | undefined => {
const matchView = (viewItem: ViewItem) => {
if (
(mustBeIonRoute && !viewItem.ionRoute) ||
@ -54,13 +54,7 @@ export const createViewStacks = (router: Router) => {
}
const resolvedPath = router.resolve(path);
let findMatchedRoute;
// TODO: Remove in Ionic Vue v6.0
if (useDeprecatedRouteSetup) {
findMatchedRoute = resolvedPath.matched.find((matchedRoute: RouteLocationMatched) => matchedRoute === viewItem.matchedRoute && (path === viewItem.pathname || matchedRoute.path.includes(':')));
} else {
findMatchedRoute = resolvedPath.matched.find((matchedRoute: RouteLocationMatched) => matchedRoute === viewItem.matchedRoute);
}
const findMatchedRoute = resolvedPath.matched.find((matchedRoute: RouteLocationMatched) => matchedRoute === viewItem.matchedRoute);
if (findMatchedRoute) {
return viewItem;