From 4bcce814bcf8fa51ee595fc914fbe772c50579be Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 14 Jun 2021 14:49:47 +0200 Subject: [PATCH] refactor(devtools): reuse var --- src/devtools/plugin.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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) => { -- 2.47.2