Skip to content

Commit 5b0c92c

Browse files
committed
docs: skipHydrate api
1 parent 5d44937 commit 5b0c92c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/pinia/src/store.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ const skipHydrateSymbol = __DEV__
8484
: /* istanbul ignore next */ Symbol()
8585
const skipHydrateMap = /*#__PURE__*/ new WeakMap<any, any>()
8686

87+
/**
88+
* Tells Pinia to skip the hydration process of a given object. This is useful in setup stores (only) when you return a
89+
* stateful object in the store but it isn't really state. e.g. returning a router instance in a setup store.
90+
*
91+
* @param obj - target object
92+
* @returns obj
93+
*/
8794
export function skipHydrate<T = any>(obj: T): T {
8895
return isVue2
8996
? // in @vue/composition-api, the refs are sealed so defineProperty doesn't work...

0 commit comments

Comments
 (0)