File tree 1 file changed +9
-9
lines changed
packages/nuxt/src/runtime
1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -6,22 +6,22 @@ import {
6
6
} from 'pinia'
7
7
export * from 'pinia'
8
8
9
- export const usePinia = ( ) => useNuxtApp ( ) . $pinia
9
+ export const usePinia = ( ) => useNuxtApp ( ) . $pinia as Pinia | undefined
10
10
11
- export const defineStore = ( ...args ) => {
11
+ export const defineStore : typeof _defineStore = (
12
+ ...args : [ idOrOptions : any , setup ?: any , setupOptions ?: any ]
13
+ ) => {
12
14
if ( ! import . meta. server ) {
13
15
return _defineStore ( ...args )
14
16
}
15
17
16
- const store = _defineStore ( ...args )
17
-
18
+ const originalUseStore = _defineStore ( ...args )
18
19
function useStore ( pinia ?: Pinia | null , hot ?: StoreGeneric ) : StoreGeneric {
19
- if ( pinia ) {
20
- return store ( pinia , hot )
21
- }
22
-
23
- return store ( usePinia ( ) , hot )
20
+ return originalUseStore ( pinia || usePinia ( ) , hot )
24
21
}
25
22
23
+ useStore . $id = originalUseStore . $id
24
+ useStore . _pinia = originalUseStore . _pinia
25
+
26
26
return useStore
27
27
}
You can’t perform that action at this time.
0 commit comments