This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 422
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for abstract length arrays in React reconcilation and se…
…rialization (#2571) Summary: Release notes: none This PR fixes issues with the React hoisting and equivalence system mechanics and serialization where previous, there was no support for abstract length arrays. This includes an optimization for when the React serializer outputs ReactElement children that are conditionals with one side being an empty value (in this case, we can use an empty string instead). Tests attached that focus on the areas covered in this PR. Pull Request resolved: #2571 Differential Revision: D10082133 Pulled By: trueadm fbshipit-source-id: d7de1834e10a5c4b3f35a90b9676ec72c6e797e2
- Loading branch information
1 parent
9681e2e
commit 47cb48b
Showing
11 changed files
with
593 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
var React = require("react"); | ||
|
||
function App(props) { | ||
var arr = [1, 2, 3]; | ||
|
||
if (props.cond) { | ||
arr.push(4); | ||
} else { | ||
arr.pop(); | ||
} | ||
return ( | ||
<div> | ||
<span x={arr} /> | ||
<span x={arr} /> | ||
</div> | ||
); | ||
} | ||
|
||
App.getTrials = function(renderer, Root) { | ||
let results = []; | ||
renderer.update(<Root cond={true} />); | ||
results.push(["abstract array length on prop (cond: true)", renderer.toJSON()]); | ||
renderer.update(<Root cond={false} />); | ||
results.push(["abstract array length on prop (cond: false)", renderer.toJSON()]); | ||
return results; | ||
}; | ||
|
||
if (this.__optimizeReactComponentTree) { | ||
__optimizeReactComponentTree(App); | ||
} | ||
|
||
module.exports = App; |
Oops, something went wrong.