Skip to content

Commit d715bda

Browse files
cexosoxiongjieposva
authored
feat: export piniaSymbol (#2973)
* feat: export piniaSymbol * chore: doc piniaSymbol --------- Co-authored-by: xiongjie <jiexiong@futunn.com> Co-authored-by: Eduardo San Martin Morote <posva13@gmail.com>
1 parent ebea680 commit d715bda

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎packages/pinia/src/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @module pinia
33
*/
4-
export { setActivePinia, getActivePinia } from './rootStore'
4+
export { setActivePinia, getActivePinia, piniaSymbol } from './rootStore'
55
export { createPinia, disposePinia } from './createPinia'
66
export type { Pinia, PiniaPlugin, PiniaPluginContext } from './rootStore'
77

‎packages/pinia/src/rootStore.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,17 @@ export interface Pinia {
111111
_testing?: boolean
112112
}
113113

114+
/**
115+
* Symbol used to provide/inject the pinia instance in the app. Used internally
116+
* and exposed for testing purposes and edge cases like storybook. Could break
117+
* in a minor, **USE AT YOUR OWN RISK**.
118+
*
119+
* For context, see:
120+
* - https://github.com/vuejs/pinia/issues/870
121+
* - https://github.com/vuejs/pinia/pull/2973
122+
*
123+
* @internal
124+
*/
114125
export const piniaSymbol = (
115126
__DEV__ ? Symbol('pinia') : /* istanbul ignore next */ Symbol()
116127
) as InjectionKey<Pinia>

0 commit comments

Comments
 (0)