Skip to content

Commit ca5f39e

Browse files
committed
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.
1 parent cd34603 commit ca5f39e

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

packages/runtime-core/src/hydration.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,13 @@ export function createHydrationFunctions({
147147
) {
148148
for (const key in props) {
149149
if (!isReservedProp(key) && isOn(key)) {
150-
patchProp(el, key, props[key], null)
150+
patchProp(el, key, null, props[key])
151151
}
152152
}
153153
} else if (props.onClick != null) {
154154
// Fast path for click listeners (which is most often) to avoid
155155
// iterating through props.
156-
patchProp(el, 'onClick', props.onClick, null)
156+
patchProp(el, 'onClick', null, props.onClick)
157157
}
158158
// vnode hooks
159159
const { onVnodeBeforeMount, onVnodeMounted } = props

packages/runtime-core/src/renderer.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ export interface RendererOptions<HostNode = any, HostElement = any> {
8585
patchProp(
8686
el: HostElement,
8787
key: string,
88-
value: any,
89-
oldValue: any,
88+
prevValue: any,
89+
nextValue: any,
9090
isSVG?: boolean,
9191
prevChildren?: VNode<HostNode, HostElement>[],
9292
parentComponent?: ComponentInternalInstance | null,
@@ -541,7 +541,7 @@ function baseCreateRenderer<
541541
if (props != null) {
542542
for (const key in props) {
543543
if (!isReservedProp(key)) {
544-
hostPatchProp(el, key, props[key], null, isSVG)
544+
hostPatchProp(el, key, null, props[key], isSVG)
545545
}
546546
}
547547
if (props.onVnodeBeforeMount != null) {
@@ -667,14 +667,14 @@ function baseCreateRenderer<
667667
// this flag is matched when the element has dynamic class bindings.
668668
if (patchFlag & PatchFlags.CLASS) {
669669
if (oldProps.class !== newProps.class) {
670-
hostPatchProp(el, 'class', newProps.class, null, isSVG)
670+
hostPatchProp(el, 'class', null, newProps.class, isSVG)
671671
}
672672
}
673673

674674
// style
675675
// this flag is matched when the element has dynamic style bindings
676676
if (patchFlag & PatchFlags.STYLE) {
677-
hostPatchProp(el, 'style', newProps.style, oldProps.style, isSVG)
677+
hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG)
678678
}
679679

680680
// props
@@ -694,8 +694,8 @@ function baseCreateRenderer<
694694
hostPatchProp(
695695
el,
696696
key,
697-
next,
698697
prev,
698+
next,
699699
isSVG,
700700
n1.children as HostVNode[],
701701
parentComponent,
@@ -814,8 +814,8 @@ function baseCreateRenderer<
814814
hostPatchProp(
815815
el,
816816
key,
817-
next,
818817
prev,
818+
next,
819819
isSVG,
820820
vnode.children as HostVNode[],
821821
parentComponent,
@@ -830,8 +830,8 @@ function baseCreateRenderer<
830830
hostPatchProp(
831831
el,
832832
key,
833-
null,
834833
oldProps[key],
834+
null,
835835
isSVG,
836836
vnode.children as HostVNode[],
837837
parentComponent,

packages/runtime-dom/src/patchProp.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { RendererOptions } from '@vue/runtime-core'
99
export const patchProp: RendererOptions<Node, Element>['patchProp'] = (
1010
el,
1111
key,
12-
nextValue,
1312
prevValue,
13+
nextValue,
1414
isSVG = false,
1515
prevChildren,
1616
parentComponent,

packages/runtime-test/src/patchProp.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { isOn } from '@vue/shared'
44
export function patchProp(
55
el: TestElement,
66
key: string,
7-
nextValue: any,
8-
prevValue: any
7+
prevValue: any,
8+
nextValue: any
99
) {
1010
logNodeOp({
1111
type: NodeOpTypes.PATCH,

0 commit comments

Comments
 (0)