]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
feat: enable calling `useStore()` in client
authorEduardo San Martin Morote <posva13@gmail.com>
Thu, 7 Jan 2021 16:23:03 +0000 (17:23 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Thu, 7 Jan 2021 16:23:03 +0000 (17:23 +0100)
src/rootStore.ts

index 17d363a97dd52d67c948f9196ccd6c81b2cbe547..6c63f6b9601b36522d892fe674b087d7602fe08e 100644 (file)
@@ -125,6 +125,9 @@ export function createPinia(): Pinia {
       // only set the app on client for devtools
       if (__BROWSER__ && IS_CLIENT) {
         setClientApp(app)
+        // this allows calling useStore() outside of a component setup after
+        // installing pinia's plugin
+        setActivePinia(pinia)
       }
       toBeInstalled.forEach((plugin) => _p.push(plugin.bind(null, localApp!)))
     },