From: Eduardo San Martin Morote Date: Thu, 7 Jan 2021 16:23:03 +0000 (+0100) Subject: feat: enable calling `useStore()` in client X-Git-Tag: v2.0.0-alpha.7~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c949b80391cae322f024b8cc369be351d5d6a693;p=thirdparty%2Fvuejs%2Fpinia.git feat: enable calling `useStore()` in client --- diff --git a/src/rootStore.ts b/src/rootStore.ts index 17d363a9..6c63f6b9 100644 --- a/src/rootStore.ts +++ b/src/rootStore.ts @@ -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!))) },