From c949b80391cae322f024b8cc369be351d5d6a693 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 7 Jan 2021 17:23:03 +0100 Subject: [PATCH] feat: enable calling `useStore()` in client --- src/rootStore.ts | 3 +++ 1 file changed, 3 insertions(+) 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!))) }, -- 2.47.3