Skip to content

Commit 49d4155

Browse files
committed
refactor: remove old code
1 parent 94100dc commit 49d4155

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

packages/pinia/src/store.ts

+2-10
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ function mergeReactiveObjects<
117117
const 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
*/
129128
export 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
*/
144138
export 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

150142
const { assign } = Object

0 commit comments

Comments
 (0)