Skip to content

Commit a64c19d

Browse files
committed
fix(devtools): avoid error in getters
Close #1062
1 parent 4ae35a2 commit a64c19d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/pinia/src/devtools/plugin.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,12 @@ export function registerPiniaDevtools(app: DevtoolsApp, pinia: Pinia) {
147147
key: 'getters',
148148
editable: false,
149149
value: store._getters.reduce((getters, key) => {
150-
getters[key] = store[key]
150+
try {
151+
getters[key] = store[key]
152+
} catch (error) {
153+
// @ts-expect-error: we just want to show it in devtools
154+
getters[key] = error
155+
}
151156
return getters
152157
}, {} as _GettersTree<StateTree>),
153158
})

0 commit comments

Comments
 (0)