From: Eduardo San Martin Morote Date: Mon, 14 Jun 2021 12:49:47 +0000 (+0200) Subject: refactor(devtools): reuse var X-Git-Tag: v2.0.0-beta.3~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4bcce814bcf8fa51ee595fc914fbe772c50579be;p=thirdparty%2Fvuejs%2Fpinia.git refactor(devtools): reuse var --- diff --git a/src/devtools/plugin.ts b/src/devtools/plugin.ts index d5c255fe..09171ae8 100644 --- a/src/devtools/plugin.ts +++ b/src/devtools/plugin.ts @@ -44,9 +44,10 @@ function addDevtools(app: App, store: Store) { // limited lifespan for getters. // add a dev only variable that is removed in unmounted and replace the store let hasSubscribed = true + const storeType = '🍍 ' + store.$id if (!registeredStores.has(store.$id)) { registeredStores.set(store.$id, store) - componentStateTypes.push('🍍 ' + store.$id) + componentStateTypes.push(storeType) hasSubscribed = false } @@ -121,7 +122,7 @@ function addDevtools(app: App, store: Store) { Object.values(piniaStores).forEach((store) => { payload.instanceData.state.push({ - type: '🍍 ' + store.$id, + type: storeType, key: 'state', editable: true, value: store.$state, @@ -129,7 +130,7 @@ function addDevtools(app: App, store: Store) { if (store._getters && store._getters.length) { payload.instanceData.state.push({ - type: '🍍 ' + store.$id, + type: storeType, key: 'getters', editable: false, value: store._getters.reduce((getters, key) => {