Skip to content

Commit

Permalink
fix(devtools): use older js
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed May 20, 2021
1 parent a86398a commit e35da3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/devtools/formatting.ts
Expand Up @@ -27,7 +27,7 @@ export function formatStoreForInspectorState(
]

// avoid adding empty getters
if (store._getters?.length) {
if (store._getters && store._getters.length) {
fields.push({
editable: false,
key: 'getters',
Expand Down
14 changes: 6 additions & 8 deletions src/devtools/plugin.ts
Expand Up @@ -66,13 +66,11 @@ export function addDevtools(app: App, store: Store) {
})

api.on.inspectComponent((payload, ctx) => {
if (
(
payload.componentInstance?.proxy as
| ComponentPublicInstance
| undefined
)?._pStores
) {
const proxy = (payload.componentInstance &&
payload.componentInstance.proxy) as
| ComponentPublicInstance
| undefined
if (proxy && proxy._pStores) {
const piniaStores = (
payload.componentInstance.proxy as ComponentPublicInstance
)._pStores!
Expand All @@ -85,7 +83,7 @@ export function addDevtools(app: App, store: Store) {
value: store.$state,
})

if (store._getters?.length) {
if (store._getters && store._getters.length) {
payload.instanceData.state.push({
type: '馃崓 ' + store.$id,
key: 'getters',
Expand Down

0 comments on commit e35da3b

Please sign in to comment.