Skip to content

Commit

Permalink
[attribute-behavior] Canonicalize values immediately after reading th…
Browse files Browse the repository at this point in the history
…em (#10584)

In case they are mutated
  • Loading branch information
acdlite authored and gaearon committed Aug 31, 2017
1 parent e34ac7c commit edc9c2f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fixtures/attribute-behavior/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2573,6 +2573,7 @@ function getRenderedAttributeValue(renderer, serverRenderer, attribute, type) {
};

let defaultValue;
let canonicalDefaultValue;
let result;
let canonicalResult;
let ssrResult;
Expand All @@ -2586,6 +2587,7 @@ function getRenderedAttributeValue(renderer, serverRenderer, attribute, type) {
try {
renderer.render(React.createElement(tagName, baseProps), container);
defaultValue = read(container.firstChild);
canonicalDefaultValue = getCanonicalizedValue(defaultValue);
renderer.render(React.createElement(tagName, props), container);
result = read(container.firstChild);
canonicalResult = getCanonicalizedValue(result);
Expand Down Expand Up @@ -2662,7 +2664,7 @@ function getRenderedAttributeValue(renderer, serverRenderer, attribute, type) {
defaultValue,
result,
canonicalResult,
canonicalDefaultValue: getCanonicalizedValue(defaultValue),
canonicalDefaultValue,
didWarn,
didError,
ssrResult,
Expand Down

0 comments on commit edc9c2f

Please sign in to comment.