wip(ssr): reduce reactivity overhead during ssr
This commit is contained in:
@@ -36,6 +36,14 @@ export function ref(raw?: unknown) {
|
||||
return raw
|
||||
}
|
||||
raw = convert(raw)
|
||||
|
||||
if (__SSR__) {
|
||||
return {
|
||||
_isRef: true,
|
||||
value: raw
|
||||
}
|
||||
}
|
||||
|
||||
const r = {
|
||||
_isRef: true,
|
||||
get value() {
|
||||
@@ -58,7 +66,7 @@ export function ref(raw?: unknown) {
|
||||
export function toRefs<T extends object>(
|
||||
object: T
|
||||
): { [K in keyof T]: Ref<T[K]> } {
|
||||
if (__DEV__ && !isReactive(object)) {
|
||||
if (__DEV__ && !__SSR__ && !isReactive(object)) {
|
||||
console.warn(`toRefs() expects a reactive object but received a plain one.`)
|
||||
}
|
||||
const ret: any = {}
|
||||
|
||||
Reference in New Issue
Block a user