@@ -117,7 +117,6 @@ function mergeReactiveObjects<
117117const skipHydrateSymbol = __DEV__
118118 ? Symbol ( 'pinia:skipHydration' )
119119 : /* istanbul ignore next */ Symbol ( )
120- const skipHydrateMap = /*#__PURE__*/ new WeakMap < any , any > ( )
121120
122121/**
123122 * Tells Pinia to skip the hydration process of a given object. This is useful in setup stores (only) when you return a
@@ -127,12 +126,7 @@ const skipHydrateMap = /*#__PURE__*/ new WeakMap<any, any>()
127126 * @returns obj
128127 */
129128export function skipHydrate < T = any > ( obj : T ) : T {
130- // TODO: check if can be simplified for Vue 2.7
131- return isVue2
132- ? // in @vue /composition-api (no needed in Vue 2.7),
133- // the refs are sealed so defineProperty doesn't work...
134- /* istanbul ignore next */ skipHydrateMap . set ( obj , 1 ) && obj
135- : Object . defineProperty ( obj , skipHydrateSymbol , { } )
129+ return Object . defineProperty ( obj , skipHydrateSymbol , { } )
136130}
137131
138132/**
@@ -142,9 +136,7 @@ export function skipHydrate<T = any>(obj: T): T {
142136 * @returns true if `obj` should be hydrated
143137 */
144138export function shouldHydrate ( obj : any ) {
145- return isVue2
146- ? /* istanbul ignore next */ ! skipHydrateMap . has ( obj )
147- : ! isPlainObject ( obj ) || ! obj . hasOwnProperty ( skipHydrateSymbol )
139+ return ! isPlainObject ( obj ) || ! obj . hasOwnProperty ( skipHydrateSymbol )
148140}
149141
150142const { assign } = Object
0 commit comments