From: Eduardo San Martin Morote Date: Thu, 3 Jun 2021 14:02:01 +0000 (+0200) Subject: fix(devtools): register stores X-Git-Tag: v2.0.0-beta.2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fcca788c1da61f2a406e2924fca3a8bed51b667;p=thirdparty%2Fvuejs%2Fpinia.git fix(devtools): register stores --- diff --git a/docs/.vitepress/components/TestStore.vue b/docs/.vitepress/components/TestStore.vue index 2a624eea..156f07f4 100644 --- a/docs/.vitepress/components/TestStore.vue +++ b/docs/.vitepress/components/TestStore.vue @@ -3,12 +3,20 @@ I have a store "{{ userStore.name }}". I have {{ cartStore.items.length }} items in the cart.

+
+

Counter: {{ counterStore.double }} = 2 x {{ counterStore.n }}

+ + + +
diff --git a/src/devtools/plugin.ts b/src/devtools/plugin.ts index 9e90aae7..af98d1a6 100644 --- a/src/devtools/plugin.ts +++ b/src/devtools/plugin.ts @@ -42,11 +42,13 @@ function addDevtools(app: App, store: Store) { // TODO: we probably need to ensure the latest version of the store is kept: // without effectScope, multiple stores will be created and will have a // limited lifespan for getters. + // add a dev only variable that is removed in unmounted and replace the store let hasSubscribed = true if (!registeredStores.has(store.$id)) { registeredStores.set(store.$id, store) componentStateTypes.push('🍍 ' + store.$id) - hasSubscribed = true + hasSubscribed = false + console.log('registing for the first time') } setupDevtoolsPlugin(