You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/pinia/src/rootStore.ts
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -43,8 +43,12 @@ interface _SetActivePinia {
43
43
* Get the currently active pinia if there is any.
44
44
*/
45
45
exportconstgetActivePinia=()=>
46
-
(hasInjectionContext()&&inject(piniaSymbol))||(import.meta.server ? thrownewError("Cannot get active pinia as it does not find context") : activePinia)
47
-
46
+
(hasInjectionContext()&&inject(piniaSymbol))||
47
+
(import.meta.server
48
+
? thrownewError(
49
+
'Pinia instance not found in context and cannot fall back to global activePinia on server - this would lead to shared state between requests'
50
+
)
51
+
: activePinia)
48
52
/**
49
53
* Every application must own its own pinia to be able to create stores
0 commit comments