Skip to content

Commit

Permalink
fix: check for if _Ctor is object
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Weber committed Apr 25, 2021
1 parent 37c7158 commit 985562d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/@averjs/vue-app/templates/entry-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,15 @@ import { applyAsyncData, composeComponentOptions, sanitizeComponent } from './ut
deepMapChildren(children, components, routes) {
for (const child of children) {
// Compare the components ctor to find only router components
const isRoute = routes.find(r => r === child.$options._Ctor[0]);
const isRoute = routes.find(r => {
let found = false;
for (const ctor of Object.keys(child.$options._Ctor || {})) {
if (r === child.$options._Ctor[ctor]) {
found = true;
}
}
return found;
});
if (isRoute) components.push(child);
// If App.vue component has no asyncData, push it anyway so that hmr works if it gets added later.
// Because the App.vue component always is the entry point we check if the parent is the root instance.
Expand Down

0 comments on commit 985562d

Please sign in to comment.