Skip to content

Commit

Permalink
fix(devtools): avoid error in getters
Browse files Browse the repository at this point in the history
Close #1062
  • Loading branch information
posva committed Feb 18, 2022
1 parent 4ae35a2 commit a64c19d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/pinia/src/devtools/plugin.ts
Expand Up @@ -147,7 +147,12 @@ export function registerPiniaDevtools(app: DevtoolsApp, pinia: Pinia) {
key: 'getters',
editable: false,
value: store._getters.reduce((getters, key) => {
getters[key] = store[key]
try {
getters[key] = store[key]
} catch (error) {
// @ts-expect-error: we just want to show it in devtools
getters[key] = error
}
return getters
}, {} as _GettersTree<StateTree>),
})
Expand Down

0 comments on commit a64c19d

Please sign in to comment.