File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
packages/nuxt/src/runtime Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -6,22 +6,22 @@ import {
66} from 'pinia'
77export * from 'pinia'
88
9- export const usePinia = ( ) => useNuxtApp ( ) . $pinia
9+ export const usePinia = ( ) => useNuxtApp ( ) . $pinia as Pinia | undefined
1010
11- export const defineStore = ( ...args ) => {
11+ export const defineStore : typeof _defineStore = (
12+ ...args : [ idOrOptions : any , setup ?: any , setupOptions ?: any ]
13+ ) => {
1214 if ( ! import . meta. server ) {
1315 return _defineStore ( ...args )
1416 }
1517
16- const store = _defineStore ( ...args )
17-
18+ const originalUseStore = _defineStore ( ...args )
1819 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 )
2421 }
2522
23+ useStore . $id = originalUseStore . $id
24+ useStore . _pinia = originalUseStore . _pinia
25+
2626 return useStore
2727}
You can’t perform that action at this time.
0 commit comments