Skip to content

Commit

Permalink
fix(runtime): merge aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Feb 15, 2023
1 parent a3a0843 commit 73bacd9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/runtime.ts
@@ -1,4 +1,8 @@
import type { RouteRecordRaw, RouteRecordRedirectOption } from 'vue-router'
import type {
RouteMeta,
RouteRecordRaw,
RouteRecordRedirectOption,
} from 'vue-router'

export { defineLoader as _defineLoader } from './data-fetching/defineLoader'
export type {
Expand Down Expand Up @@ -27,11 +31,17 @@ export function _mergeRouteRecord(
// @ts-expect-error: complicated types
return routeRecords.reduce((acc, routeRecord) => {
const meta = Object.assign({}, acc.meta, routeRecord.meta)
const alias: string[] = ([] as string[]).concat(
acc.alias || [],
routeRecord.alias || []
)

// TODO: other nested properties
// const props = Object.assign({}, acc.props, routeRecord.props)

Object.assign(acc, routeRecord)
acc.meta = meta
acc.alias = alias
return acc
}, main)
}

0 comments on commit 73bacd9

Please sign in to comment.