chore: revert prettier
This commit is contained in:
@@ -288,12 +288,12 @@ export function applyOptions(
|
||||
set: isFunction(set)
|
||||
? set.bind(ctx)
|
||||
: __DEV__
|
||||
? () => {
|
||||
warn(
|
||||
`Computed property "${key}" was assigned to but it has no setter.`
|
||||
)
|
||||
}
|
||||
: NOOP
|
||||
? () => {
|
||||
warn(
|
||||
`Computed property "${key}" was assigned to but it has no setter.`
|
||||
)
|
||||
}
|
||||
: NOOP
|
||||
})
|
||||
} else if (__DEV__) {
|
||||
warn(`Computed property "${key}" has no getter.`)
|
||||
|
||||
@@ -61,7 +61,7 @@ export function watch<T>(
|
||||
): StopHandle
|
||||
|
||||
// overload #3: array of multiple sources + cb
|
||||
export function watch<T extends readonly WatcherSource<unknown>[]>(
|
||||
export function watch<T extends Readonly<WatcherSource<unknown>[]>>(
|
||||
sources: T,
|
||||
cb: WatchHandler<MapSources<T>>,
|
||||
options?: WatchOptions
|
||||
@@ -94,10 +94,11 @@ function doWatch(
|
||||
let getter: () => any
|
||||
if (isArray(source)) {
|
||||
getter = () =>
|
||||
source.map(s =>
|
||||
isRef(s)
|
||||
? s.value
|
||||
: callWithErrorHandling(s, instance, ErrorCodes.WATCH_GETTER)
|
||||
source.map(
|
||||
s =>
|
||||
isRef(s)
|
||||
? s.value
|
||||
: callWithErrorHandling(s, instance, ErrorCodes.WATCH_GETTER)
|
||||
)
|
||||
} else if (isRef(source)) {
|
||||
getter = () => source.value
|
||||
|
||||
@@ -53,12 +53,10 @@ type OptionalKeys<T, MakeDefaultRequired> = Exclude<
|
||||
type InferPropType<T> = T extends null
|
||||
? any // null & true would fail to infer
|
||||
: T extends { type: null | true }
|
||||
? any // somehow `ObjectConstructor` when inferred from { (): T } becomes `any`
|
||||
: T extends ObjectConstructor | { type: ObjectConstructor }
|
||||
? { [key: string]: any }
|
||||
: T extends Prop<infer V>
|
||||
? V
|
||||
: T
|
||||
? any // somehow `ObjectConstructor` when inferred from { (): T } becomes `any`
|
||||
: T extends ObjectConstructor | { type: ObjectConstructor }
|
||||
? { [key: string]: any }
|
||||
: T extends Prop<infer V> ? V : T
|
||||
|
||||
export type ExtractPropTypes<
|
||||
O,
|
||||
|
||||
@@ -1162,83 +1162,72 @@ export function createRenderer<
|
||||
) {
|
||||
// create reactive effect for rendering
|
||||
let mounted = false
|
||||
instance.update = effect(
|
||||
function componentEffect() {
|
||||
if (!mounted) {
|
||||
const subTree = (instance.subTree = renderComponentRoot(instance))
|
||||
// beforeMount hook
|
||||
if (instance.bm !== null) {
|
||||
invokeHooks(instance.bm)
|
||||
}
|
||||
patch(
|
||||
null,
|
||||
subTree,
|
||||
container,
|
||||
anchor,
|
||||
instance,
|
||||
parentSuspense,
|
||||
isSVG
|
||||
)
|
||||
initialVNode.el = subTree.el
|
||||
// mounted hook
|
||||
if (instance.m !== null) {
|
||||
queuePostRenderEffect(instance.m, parentSuspense)
|
||||
}
|
||||
mounted = true
|
||||
} else {
|
||||
// updateComponent
|
||||
// This is triggered by mutation of component's own state (next: null)
|
||||
// OR parent calling processComponent (next: HostVNode)
|
||||
const { next } = instance
|
||||
|
||||
if (__DEV__) {
|
||||
pushWarningContext(next || instance.vnode)
|
||||
}
|
||||
|
||||
if (next !== null) {
|
||||
updateComponentPreRender(instance, next)
|
||||
}
|
||||
const prevTree = instance.subTree
|
||||
const nextTree = (instance.subTree = renderComponentRoot(instance))
|
||||
// beforeUpdate hook
|
||||
if (instance.bu !== null) {
|
||||
invokeHooks(instance.bu)
|
||||
}
|
||||
// reset refs
|
||||
// only needed if previous patch had refs
|
||||
if (instance.refs !== EMPTY_OBJ) {
|
||||
instance.refs = {}
|
||||
}
|
||||
patch(
|
||||
prevTree,
|
||||
nextTree,
|
||||
// parent may have changed if it's in a portal
|
||||
hostParentNode(prevTree.el as HostNode) as HostElement,
|
||||
// anchor may have changed if it's in a fragment
|
||||
getNextHostNode(prevTree),
|
||||
instance,
|
||||
parentSuspense,
|
||||
isSVG
|
||||
)
|
||||
instance.vnode.el = nextTree.el
|
||||
if (next === null) {
|
||||
// self-triggered update. In case of HOC, update parent component
|
||||
// vnode el. HOC is indicated by parent instance's subTree pointing
|
||||
// to child component's vnode
|
||||
updateHOCHostEl(instance, nextTree.el)
|
||||
}
|
||||
// updated hook
|
||||
if (instance.u !== null) {
|
||||
queuePostRenderEffect(instance.u, parentSuspense)
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
popWarningContext()
|
||||
}
|
||||
instance.update = effect(function componentEffect() {
|
||||
if (!mounted) {
|
||||
const subTree = (instance.subTree = renderComponentRoot(instance))
|
||||
// beforeMount hook
|
||||
if (instance.bm !== null) {
|
||||
invokeHooks(instance.bm)
|
||||
}
|
||||
},
|
||||
__DEV__ ? createDevEffectOptions(instance) : prodEffectOptions
|
||||
)
|
||||
patch(null, subTree, container, anchor, instance, parentSuspense, isSVG)
|
||||
initialVNode.el = subTree.el
|
||||
// mounted hook
|
||||
if (instance.m !== null) {
|
||||
queuePostRenderEffect(instance.m, parentSuspense)
|
||||
}
|
||||
mounted = true
|
||||
} else {
|
||||
// updateComponent
|
||||
// This is triggered by mutation of component's own state (next: null)
|
||||
// OR parent calling processComponent (next: HostVNode)
|
||||
const { next } = instance
|
||||
|
||||
if (__DEV__) {
|
||||
pushWarningContext(next || instance.vnode)
|
||||
}
|
||||
|
||||
if (next !== null) {
|
||||
updateComponentPreRender(instance, next)
|
||||
}
|
||||
const prevTree = instance.subTree
|
||||
const nextTree = (instance.subTree = renderComponentRoot(instance))
|
||||
// beforeUpdate hook
|
||||
if (instance.bu !== null) {
|
||||
invokeHooks(instance.bu)
|
||||
}
|
||||
// reset refs
|
||||
// only needed if previous patch had refs
|
||||
if (instance.refs !== EMPTY_OBJ) {
|
||||
instance.refs = {}
|
||||
}
|
||||
patch(
|
||||
prevTree,
|
||||
nextTree,
|
||||
// parent may have changed if it's in a portal
|
||||
hostParentNode(prevTree.el as HostNode) as HostElement,
|
||||
// anchor may have changed if it's in a fragment
|
||||
getNextHostNode(prevTree),
|
||||
instance,
|
||||
parentSuspense,
|
||||
isSVG
|
||||
)
|
||||
instance.vnode.el = nextTree.el
|
||||
if (next === null) {
|
||||
// self-triggered update. In case of HOC, update parent component
|
||||
// vnode el. HOC is indicated by parent instance's subTree pointing
|
||||
// to child component's vnode
|
||||
updateHOCHostEl(instance, nextTree.el)
|
||||
}
|
||||
// updated hook
|
||||
if (instance.u !== null) {
|
||||
queuePostRenderEffect(instance.u, parentSuspense)
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
popWarningContext()
|
||||
}
|
||||
}
|
||||
}, __DEV__ ? createDevEffectOptions(instance) : prodEffectOptions)
|
||||
}
|
||||
|
||||
function updateComponentPreRender(
|
||||
|
||||
@@ -5,6 +5,6 @@ export function toString(val: unknown): string {
|
||||
return val == null
|
||||
? ''
|
||||
: isArray(val) || (isPlainObject(val) && val.toString === objectToString)
|
||||
? JSON.stringify(val, null, 2)
|
||||
: String(val)
|
||||
? JSON.stringify(val, null, 2)
|
||||
: String(val)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user