Skip to content

Commit 89feb7e

Browse files
committed
Make ART Concurrent if Legacy Mode is disabled (#28662)
Pulling this out of #28657. This runs react-art in concurrent mode if disableLegacyMode is true. Effectively this means that the OSS version will be in concurrent mode and the `.modern.js` version for Meta will be in concurrent mode, once the flag flips for modern, but the `.classic.js` version for Meta will be in legacy mode. Updates flowing in from above flush synchronously so that they commit as a unit. This also ensures that refs are resolved before the parent life cycles. setStates deep in the tree will now be batched using "discrete" priority but should still happen same task. DiffTrain build for [5fcaa0a](5fcaa0a)
1 parent 8a319a6 commit 89feb7e

File tree

5 files changed

+275
-121
lines changed

5 files changed

+275
-121
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8cb6a1c0347a69ad4c580c5cf5f28d8be544d6d4
1+
5fcaa0a832db9573364cb73738e0a3b4cf2d27f2

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if (__DEV__) {
6666
return self;
6767
}
6868

69-
var ReactVersion = "19.0.0-www-classic-cbebd2c1";
69+
var ReactVersion = "19.0.0-www-classic-19a521f0";
7070

7171
var LegacyRoot = 0;
7272
var ConcurrentRoot = 1;
@@ -31074,6 +31074,8 @@ if (__DEV__) {
3107431074
var _proto4 = Surface.prototype;
3107531075

3107631076
_proto4.componentDidMount = function componentDidMount() {
31077+
var _this = this;
31078+
3107731079
var _this$props = this.props,
3107831080
height = _this$props.height,
3107931081
width = _this$props.width;
@@ -31085,36 +31087,51 @@ if (__DEV__) {
3108531087
false,
3108631088
false,
3108731089
""
31088-
);
31089-
updateContainer(this.props.children, this._mountNode, this);
31090+
); // We synchronously flush updates coming from above so that they commit together
31091+
// and so that refs resolve before the parent life cycles.
31092+
31093+
flushSync(function () {
31094+
updateContainer(_this.props.children, _this._mountNode, _this);
31095+
});
3109031096
};
3109131097

3109231098
_proto4.componentDidUpdate = function componentDidUpdate(
3109331099
prevProps,
3109431100
prevState
3109531101
) {
31102+
var _this2 = this;
31103+
3109631104
var props = this.props;
3109731105

3109831106
if (
3109931107
props.height !== prevProps.height ||
3110031108
props.width !== prevProps.width
3110131109
) {
3110231110
this._surface.resize(+props.width, +props.height);
31103-
}
31111+
} // We synchronously flush updates coming from above so that they commit together
31112+
// and so that refs resolve before the parent life cycles.
3110431113

31105-
updateContainer(this.props.children, this._mountNode, this);
31114+
flushSync(function () {
31115+
updateContainer(_this2.props.children, _this2._mountNode, _this2);
31116+
});
3110631117

3110731118
if (this._surface.render) {
3110831119
this._surface.render();
3110931120
}
3111031121
};
3111131122

3111231123
_proto4.componentWillUnmount = function componentWillUnmount() {
31113-
updateContainer(null, this._mountNode, this);
31124+
var _this3 = this;
31125+
31126+
// We synchronously flush updates coming from above so that they commit together
31127+
// and so that refs resolve before the parent life cycles.
31128+
flushSync(function () {
31129+
updateContainer(null, _this3._mountNode, _this3);
31130+
});
3111431131
};
3111531132

3111631133
_proto4.render = function render() {
31117-
var _this = this;
31134+
var _this4 = this;
3111831135

3111931136
// This is going to be a placeholder because we don't know what it will
3112031137
// actually resolve to because ART may render canvas, vml or svg tags here.
@@ -31125,7 +31142,7 @@ if (__DEV__) {
3112531142
var Tag = Mode$1.Surface.tagName;
3112631143
return /*#__PURE__*/ React.createElement(Tag, {
3112731144
ref: function (ref) {
31128-
return (_this._tagRef = ref);
31145+
return (_this4._tagRef = ref);
3112931146
},
3113031147
accessKey: props.accessKey,
3113131148
className: props.className,
@@ -31144,33 +31161,33 @@ if (__DEV__) {
3114431161
_inheritsLoose(Text, _React$Component2);
3114531162

3114631163
function Text(props) {
31147-
var _this2;
31164+
var _this5;
3114831165

31149-
_this2 = _React$Component2.call(this, props) || this; // We allow reading these props. Ideally we could expose the Text node as
31166+
_this5 = _React$Component2.call(this, props) || this; // We allow reading these props. Ideally we could expose the Text node as
3115031167
// ref directly.
3115131168

3115231169
["height", "width", "x", "y"].forEach(function (key) {
31153-
Object.defineProperty(_assertThisInitialized(_this2), key, {
31170+
Object.defineProperty(_assertThisInitialized(_this5), key, {
3115431171
get: function () {
3115531172
return this._text ? this._text[key] : undefined;
3115631173
}
3115731174
});
3115831175
});
31159-
return _this2;
31176+
return _this5;
3116031177
}
3116131178

3116231179
var _proto5 = Text.prototype;
3116331180

3116431181
_proto5.render = function render() {
31165-
var _this3 = this;
31182+
var _this6 = this;
3116631183

3116731184
// This means you can't have children that render into strings...
3116831185
var T = TYPES.TEXT;
3116931186
return /*#__PURE__*/ React.createElement(
3117031187
T,
3117131188
_extends({}, this.props, {
3117231189
ref: function (t) {
31173-
return (_this3._text = t);
31190+
return (_this6._text = t);
3117431191
}
3117531192
}),
3117631193
childrenAsString(this.props.children)

compiled/facebook-www/ReactART-dev.modern.js

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if (__DEV__) {
6666
return self;
6767
}
6868

69-
var ReactVersion = "19.0.0-www-modern-62398be5";
69+
var ReactVersion = "19.0.0-www-modern-55690e70";
7070

7171
var LegacyRoot = 0;
7272
var ConcurrentRoot = 1;
@@ -30724,6 +30724,8 @@ if (__DEV__) {
3072430724
var _proto4 = Surface.prototype;
3072530725

3072630726
_proto4.componentDidMount = function componentDidMount() {
30727+
var _this = this;
30728+
3072730729
var _this$props = this.props,
3072830730
height = _this$props.height,
3072930731
width = _this$props.width;
@@ -30735,36 +30737,51 @@ if (__DEV__) {
3073530737
false,
3073630738
false,
3073730739
""
30738-
);
30739-
updateContainer(this.props.children, this._mountNode, this);
30740+
); // We synchronously flush updates coming from above so that they commit together
30741+
// and so that refs resolve before the parent life cycles.
30742+
30743+
flushSync(function () {
30744+
updateContainer(_this.props.children, _this._mountNode, _this);
30745+
});
3074030746
};
3074130747

3074230748
_proto4.componentDidUpdate = function componentDidUpdate(
3074330749
prevProps,
3074430750
prevState
3074530751
) {
30752+
var _this2 = this;
30753+
3074630754
var props = this.props;
3074730755

3074830756
if (
3074930757
props.height !== prevProps.height ||
3075030758
props.width !== prevProps.width
3075130759
) {
3075230760
this._surface.resize(+props.width, +props.height);
30753-
}
30761+
} // We synchronously flush updates coming from above so that they commit together
30762+
// and so that refs resolve before the parent life cycles.
3075430763

30755-
updateContainer(this.props.children, this._mountNode, this);
30764+
flushSync(function () {
30765+
updateContainer(_this2.props.children, _this2._mountNode, _this2);
30766+
});
3075630767

3075730768
if (this._surface.render) {
3075830769
this._surface.render();
3075930770
}
3076030771
};
3076130772

3076230773
_proto4.componentWillUnmount = function componentWillUnmount() {
30763-
updateContainer(null, this._mountNode, this);
30774+
var _this3 = this;
30775+
30776+
// We synchronously flush updates coming from above so that they commit together
30777+
// and so that refs resolve before the parent life cycles.
30778+
flushSync(function () {
30779+
updateContainer(null, _this3._mountNode, _this3);
30780+
});
3076430781
};
3076530782

3076630783
_proto4.render = function render() {
30767-
var _this = this;
30784+
var _this4 = this;
3076830785

3076930786
// This is going to be a placeholder because we don't know what it will
3077030787
// actually resolve to because ART may render canvas, vml or svg tags here.
@@ -30775,7 +30792,7 @@ if (__DEV__) {
3077530792
var Tag = Mode$1.Surface.tagName;
3077630793
return /*#__PURE__*/ React.createElement(Tag, {
3077730794
ref: function (ref) {
30778-
return (_this._tagRef = ref);
30795+
return (_this4._tagRef = ref);
3077930796
},
3078030797
accessKey: props.accessKey,
3078130798
className: props.className,
@@ -30794,33 +30811,33 @@ if (__DEV__) {
3079430811
_inheritsLoose(Text, _React$Component2);
3079530812

3079630813
function Text(props) {
30797-
var _this2;
30814+
var _this5;
3079830815

30799-
_this2 = _React$Component2.call(this, props) || this; // We allow reading these props. Ideally we could expose the Text node as
30816+
_this5 = _React$Component2.call(this, props) || this; // We allow reading these props. Ideally we could expose the Text node as
3080030817
// ref directly.
3080130818

3080230819
["height", "width", "x", "y"].forEach(function (key) {
30803-
Object.defineProperty(_assertThisInitialized(_this2), key, {
30820+
Object.defineProperty(_assertThisInitialized(_this5), key, {
3080430821
get: function () {
3080530822
return this._text ? this._text[key] : undefined;
3080630823
}
3080730824
});
3080830825
});
30809-
return _this2;
30826+
return _this5;
3081030827
}
3081130828

3081230829
var _proto5 = Text.prototype;
3081330830

3081430831
_proto5.render = function render() {
30815-
var _this3 = this;
30832+
var _this6 = this;
3081630833

3081730834
// This means you can't have children that render into strings...
3081830835
var T = TYPES.TEXT;
3081930836
return /*#__PURE__*/ React.createElement(
3082030837
T,
3082130838
_extends({}, this.props, {
3082230839
ref: function (t) {
30823-
return (_this3._text = t);
30840+
return (_this6._text = t);
3082430841
}
3082530842
}),
3082630843
childrenAsString(this.props.children)

0 commit comments

Comments
 (0)