Skip to content

Commit 35b3fca

Browse files
fix(vue2): Remove throwing error on inspect missing vuex module (#2095)
1 parent 8b6f96b commit 35b3fca

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/app-backend-vue2/src/plugin.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ export function setupPlugin (api: DevtoolsApi, app: App, Vue) {
117117
if (payload.inspectorId === VUEX_INSPECTOR_ID) {
118118
const modulePath = payload.nodeId
119119
const module = getStoreModule(store._modules, modulePath)
120+
if (!module) {
121+
return
122+
}
120123
// Access the getters prop to init getters cache (which is lazy)
121124
// eslint-disable-next-line no-unused-expressions
122125
module.context.getters
@@ -496,10 +499,8 @@ function getStoreModule (moduleMap, path) {
496499
const names = path.split(VUEX_MODULE_PATH_SEPARATOR).filter((n) => n)
497500
return names.reduce(
498501
(module, moduleName, i) => {
499-
const child = module[moduleName === VUEX_ROOT_PATH ? 'root' : moduleName]
500-
if (!child) {
501-
throw new Error(`Missing module "${moduleName}" for path "${path}".`)
502-
}
502+
const child = module ? module[moduleName === VUEX_ROOT_PATH ? 'root' : moduleName] : null
503+
if (!child) return null
503504
return i === names.length - 1 ? child : child._children
504505
},
505506
path === VUEX_ROOT_PATH ? moduleMap : moduleMap.root._children,

0 commit comments

Comments
 (0)