refactor(runtime-core): adjust patchProp value arguments order
BREAKING CHANGE: `RendererOptions.patchProp` arguments order has changed The `prevValue` and `nextValue` position has been swapped to keep it consistent with other functions in the renderer implementation. This only affects custom renderers using the `createRenderer` API.
This commit is contained in:
parent
cd34603864
commit
ca5f39ee35
@ -147,13 +147,13 @@ export function createHydrationFunctions({
|
|||||||
) {
|
) {
|
||||||
for (const key in props) {
|
for (const key in props) {
|
||||||
if (!isReservedProp(key) && isOn(key)) {
|
if (!isReservedProp(key) && isOn(key)) {
|
||||||
patchProp(el, key, props[key], null)
|
patchProp(el, key, null, props[key])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (props.onClick != null) {
|
} else if (props.onClick != null) {
|
||||||
// Fast path for click listeners (which is most often) to avoid
|
// Fast path for click listeners (which is most often) to avoid
|
||||||
// iterating through props.
|
// iterating through props.
|
||||||
patchProp(el, 'onClick', props.onClick, null)
|
patchProp(el, 'onClick', null, props.onClick)
|
||||||
}
|
}
|
||||||
// vnode hooks
|
// vnode hooks
|
||||||
const { onVnodeBeforeMount, onVnodeMounted } = props
|
const { onVnodeBeforeMount, onVnodeMounted } = props
|
||||||
|
@ -85,8 +85,8 @@ export interface RendererOptions<HostNode = any, HostElement = any> {
|
|||||||
patchProp(
|
patchProp(
|
||||||
el: HostElement,
|
el: HostElement,
|
||||||
key: string,
|
key: string,
|
||||||
value: any,
|
prevValue: any,
|
||||||
oldValue: any,
|
nextValue: any,
|
||||||
isSVG?: boolean,
|
isSVG?: boolean,
|
||||||
prevChildren?: VNode<HostNode, HostElement>[],
|
prevChildren?: VNode<HostNode, HostElement>[],
|
||||||
parentComponent?: ComponentInternalInstance | null,
|
parentComponent?: ComponentInternalInstance | null,
|
||||||
@ -541,7 +541,7 @@ function baseCreateRenderer<
|
|||||||
if (props != null) {
|
if (props != null) {
|
||||||
for (const key in props) {
|
for (const key in props) {
|
||||||
if (!isReservedProp(key)) {
|
if (!isReservedProp(key)) {
|
||||||
hostPatchProp(el, key, props[key], null, isSVG)
|
hostPatchProp(el, key, null, props[key], isSVG)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (props.onVnodeBeforeMount != null) {
|
if (props.onVnodeBeforeMount != null) {
|
||||||
@ -667,14 +667,14 @@ function baseCreateRenderer<
|
|||||||
// this flag is matched when the element has dynamic class bindings.
|
// this flag is matched when the element has dynamic class bindings.
|
||||||
if (patchFlag & PatchFlags.CLASS) {
|
if (patchFlag & PatchFlags.CLASS) {
|
||||||
if (oldProps.class !== newProps.class) {
|
if (oldProps.class !== newProps.class) {
|
||||||
hostPatchProp(el, 'class', newProps.class, null, isSVG)
|
hostPatchProp(el, 'class', null, newProps.class, isSVG)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// style
|
// style
|
||||||
// this flag is matched when the element has dynamic style bindings
|
// this flag is matched when the element has dynamic style bindings
|
||||||
if (patchFlag & PatchFlags.STYLE) {
|
if (patchFlag & PatchFlags.STYLE) {
|
||||||
hostPatchProp(el, 'style', newProps.style, oldProps.style, isSVG)
|
hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG)
|
||||||
}
|
}
|
||||||
|
|
||||||
// props
|
// props
|
||||||
@ -694,8 +694,8 @@ function baseCreateRenderer<
|
|||||||
hostPatchProp(
|
hostPatchProp(
|
||||||
el,
|
el,
|
||||||
key,
|
key,
|
||||||
next,
|
|
||||||
prev,
|
prev,
|
||||||
|
next,
|
||||||
isSVG,
|
isSVG,
|
||||||
n1.children as HostVNode[],
|
n1.children as HostVNode[],
|
||||||
parentComponent,
|
parentComponent,
|
||||||
@ -814,8 +814,8 @@ function baseCreateRenderer<
|
|||||||
hostPatchProp(
|
hostPatchProp(
|
||||||
el,
|
el,
|
||||||
key,
|
key,
|
||||||
next,
|
|
||||||
prev,
|
prev,
|
||||||
|
next,
|
||||||
isSVG,
|
isSVG,
|
||||||
vnode.children as HostVNode[],
|
vnode.children as HostVNode[],
|
||||||
parentComponent,
|
parentComponent,
|
||||||
@ -830,8 +830,8 @@ function baseCreateRenderer<
|
|||||||
hostPatchProp(
|
hostPatchProp(
|
||||||
el,
|
el,
|
||||||
key,
|
key,
|
||||||
null,
|
|
||||||
oldProps[key],
|
oldProps[key],
|
||||||
|
null,
|
||||||
isSVG,
|
isSVG,
|
||||||
vnode.children as HostVNode[],
|
vnode.children as HostVNode[],
|
||||||
parentComponent,
|
parentComponent,
|
||||||
|
@ -9,8 +9,8 @@ import { RendererOptions } from '@vue/runtime-core'
|
|||||||
export const patchProp: RendererOptions<Node, Element>['patchProp'] = (
|
export const patchProp: RendererOptions<Node, Element>['patchProp'] = (
|
||||||
el,
|
el,
|
||||||
key,
|
key,
|
||||||
nextValue,
|
|
||||||
prevValue,
|
prevValue,
|
||||||
|
nextValue,
|
||||||
isSVG = false,
|
isSVG = false,
|
||||||
prevChildren,
|
prevChildren,
|
||||||
parentComponent,
|
parentComponent,
|
||||||
|
@ -4,8 +4,8 @@ import { isOn } from '@vue/shared'
|
|||||||
export function patchProp(
|
export function patchProp(
|
||||||
el: TestElement,
|
el: TestElement,
|
||||||
key: string,
|
key: string,
|
||||||
nextValue: any,
|
prevValue: any,
|
||||||
prevValue: any
|
nextValue: any
|
||||||
) {
|
) {
|
||||||
logNodeOp({
|
logNodeOp({
|
||||||
type: NodeOpTypes.PATCH,
|
type: NodeOpTypes.PATCH,
|
||||||
|
Loading…
Reference in New Issue
Block a user