Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fbcdceb

Browse files
committed
We need to get the lastProp in when diffInCommitPhase is false
1 parent 9bc65c9 commit fbcdceb

File tree

1 file changed

+44
-9
lines changed

1 file changed

+44
-9
lines changed

packages/react-dom-bindings/src/client/ReactDOMComponent.js

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ export function setInitialProperties(
11821182
break;
11831183
}
11841184
default: {
1185-
setProp(domElement, tag, propKey, propValue, props);
1185+
setProp(domElement, tag, propKey, propValue, props, null);
11861186
}
11871187
}
11881188
}
@@ -1213,7 +1213,7 @@ export function setInitialProperties(
12131213
break;
12141214
}
12151215
default: {
1216-
setProp(domElement, tag, propKey, propValue, props);
1216+
setProp(domElement, tag, propKey, propValue, props, null);
12171217
}
12181218
}
12191219
}
@@ -1979,7 +1979,14 @@ export function updatePropertiesWithDiff(
19791979
break;
19801980
}
19811981
default: {
1982-
setProp(domElement, tag, propKey, propValue, nextProps, null);
1982+
setProp(
1983+
domElement,
1984+
tag,
1985+
propKey,
1986+
propValue,
1987+
nextProps,
1988+
lastProps[propKey],
1989+
);
19831990
}
19841991
}
19851992
}
@@ -2054,7 +2061,14 @@ export function updatePropertiesWithDiff(
20542061
}
20552062
// defaultValue are ignored by setProp
20562063
default: {
2057-
setProp(domElement, tag, propKey, propValue, nextProps, null);
2064+
setProp(
2065+
domElement,
2066+
tag,
2067+
propKey,
2068+
propValue,
2069+
nextProps,
2070+
lastProps[propKey],
2071+
);
20582072
}
20592073
}
20602074
}
@@ -2089,7 +2103,14 @@ export function updatePropertiesWithDiff(
20892103
}
20902104
// defaultValue is ignored by setProp
20912105
default: {
2092-
setProp(domElement, tag, propKey, propValue, nextProps, null);
2106+
setProp(
2107+
domElement,
2108+
tag,
2109+
propKey,
2110+
propValue,
2111+
nextProps,
2112+
lastProps[propKey],
2113+
);
20932114
}
20942115
}
20952116
}
@@ -2110,7 +2131,14 @@ export function updatePropertiesWithDiff(
21102131
break;
21112132
}
21122133
default: {
2113-
setProp(domElement, tag, propKey, propValue, nextProps, null);
2134+
setProp(
2135+
domElement,
2136+
tag,
2137+
propKey,
2138+
propValue,
2139+
nextProps,
2140+
lastProps[propKey],
2141+
);
21142142
}
21152143
}
21162144
}
@@ -2149,7 +2177,14 @@ export function updatePropertiesWithDiff(
21492177
}
21502178
// defaultChecked and defaultValue are ignored by setProp
21512179
default: {
2152-
setProp(domElement, tag, propKey, propValue, nextProps, null);
2180+
setProp(
2181+
domElement,
2182+
tag,
2183+
propKey,
2184+
propValue,
2185+
nextProps,
2186+
lastProps[propKey],
2187+
);
21532188
}
21542189
}
21552190
}
@@ -2166,7 +2201,7 @@ export function updatePropertiesWithDiff(
21662201
propKey,
21672202
propValue,
21682203
nextProps,
2169-
null,
2204+
lastProps[propKey],
21702205
);
21712206
}
21722207
return;
@@ -2178,7 +2213,7 @@ export function updatePropertiesWithDiff(
21782213
for (let i = 0; i < updatePayload.length; i += 2) {
21792214
const propKey = updatePayload[i];
21802215
const propValue = updatePayload[i + 1];
2181-
setProp(domElement, tag, propKey, propValue, nextProps, null);
2216+
setProp(domElement, tag, propKey, propValue, nextProps, lastProps[propKey]);
21822217
}
21832218
}
21842219

0 commit comments

Comments
 (0)