From dff9cd92bfdca3bff4aa5ab5ed906c67a94e665c Mon Sep 17 00:00:00 2001 From: sylenien Date: Tue, 30 Aug 2022 16:29:10 +0200 Subject: [PATCH] feat(tracker): fix store name arg --- tracker/tracker-vuex/src/index.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tracker/tracker-vuex/src/index.ts b/tracker/tracker-vuex/src/index.ts index 68256dc20..37cd0d2cc 100644 --- a/tracker/tracker-vuex/src/index.ts +++ b/tracker/tracker-vuex/src/index.ts @@ -5,7 +5,6 @@ export interface Options { filter: (mutation: any, state: any) => boolean; transformer: (state: any) => any; mutationTransformer: (mutation: any) => any; - storeName?: string; } function processMutationAndState( @@ -38,7 +37,6 @@ export default function(opts: Partial = {}) { filter: () => true, transformer: state => state, mutationTransformer: mutation => mutation, - storeName: undefined, }, opts ); @@ -48,12 +46,12 @@ export default function(opts: Partial = {}) { } const encoder = new Encoder(sha1, 50); const state = {}; - return store => { + return (store, storeName) => { // Vuex if (store.subscribe) { const randomId = Math.random().toString(36).substring(2, 9) store.subscribe((mutation, storeState) => { - state[options.storeName || randomId] = state + state[storeName || randomId] = state processMutationAndState(app, options, encoder, mutation, storeState); }); } @@ -62,7 +60,7 @@ export default function(opts: Partial = {}) { if (store.$onAction) { store.$onAction(({ name, store, args }) => { try { - state[options.storeName || store.$id] = store.$state; + state[storeName || store.$id] = store.$state; const mutation = { type: name, payload: args