Skip to content

Commit

Permalink
Unrevert "Support writing to this.refs from userspace" (#28879)
Browse files Browse the repository at this point in the history
Reverts #28877

We found the cause of the regression and should be able to land this
again.

DiffTrain build for commit b039be6.
  • Loading branch information
kassens committed Apr 24, 2024
1 parent 490702d commit dee0c82
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<d6449a2b2f866a42a4d0c4e9ceba56bf>>
* @generated SignedSource<<eb0bcf528c3de17c6744b81c980f6aec>>
*/

'use strict';
Expand Down Expand Up @@ -10939,7 +10939,14 @@ function mountClassInstance(workInProgress, ctor, newProps, renderLanes) {
var instance = workInProgress.stateNode;
instance.props = newProps;
instance.state = workInProgress.memoizedState;
instance.refs = {};

{
// When string refs are used in create-react-class legacy components,
// we need to make refs writable unless we patch all such copies of the
// class code that sets to a frozen emptyObject.
instance.refs = {};
}

initializeUpdateQueue(workInProgress);
var contextType = ctor.contextType;

Expand Down Expand Up @@ -22989,7 +22996,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-canary-88928511';
var ReactVersion = '19.0.0-canary-d851d267';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<5657642071f954739542e489d20fe745>>
* @generated SignedSource<<89ae74e0102293ea28fa8a01ffa204a7>>
*/

'use strict';
Expand All @@ -27,7 +27,7 @@ if (
}
var dynamicFlagsUntyped = require('ReactNativeInternalFeatureFlags');

var ReactVersion = '19.0.0-canary-bbf3fbcd';
var ReactVersion = '19.0.0-canary-ffcb8911';

// Re-export dynamic flags from the internal module.
var dynamicFlags = dynamicFlagsUntyped; // We destructure each value before re-exporting to avoid a dynamic look-up on
Expand Down Expand Up @@ -270,21 +270,14 @@ var ReactNoopUpdateQueue = {

var assign = Object.assign;

var emptyObject = {};

{
Object.freeze(emptyObject);
}
/**
* Base class helpers for the updating state of a component.
*/


function Component(props, context, updater) {
this.props = props;
this.context = context; // If a component has string refs, we will assign a different object later.

this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
this.context = context;
this.refs = {}; // We initialize the default updater but the real one gets injected by the
// renderer.

this.updater = updater || ReactNoopUpdateQueue;
Expand Down Expand Up @@ -384,7 +377,7 @@ function PureComponent(props, context, updater) {
this.props = props;
this.context = context; // If a component has string refs, we will assign a different object later.

this.refs = emptyObject;
this.refs = {};
this.updater = updater || ReactNoopUpdateQueue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<cbcacaf4b89e6773658cda69244a4be6>>
* @generated SignedSource<<429307aea5989b6d3af53d1e3daeea57>>
*/

"use strict";
Expand Down Expand Up @@ -50,12 +50,11 @@ var ReactNoopUpdateQueue = {
enqueueReplaceState: function () {},
enqueueSetState: function () {}
},
assign = Object.assign,
emptyObject = {};
assign = Object.assign;
function Component(props, context, updater) {
this.props = props;
this.context = context;
this.refs = emptyObject;
this.refs = {};
this.updater = updater || ReactNoopUpdateQueue;
}
Component.prototype.isReactComponent = {};
Expand All @@ -78,7 +77,7 @@ ComponentDummy.prototype = Component.prototype;
function PureComponent(props, context, updater) {
this.props = props;
this.context = context;
this.refs = emptyObject;
this.refs = {};
this.updater = updater || ReactNoopUpdateQueue;
}
var pureComponentPrototype = (PureComponent.prototype = new ComponentDummy());
Expand Down Expand Up @@ -679,4 +678,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-canary-55ecd63c";
exports.version = "19.0.0-canary-a22219fc";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<fca7ed5acdad0291a3b263d96d523766>>
* @generated SignedSource<<90a5fdd3d2d77ff49898cf96e4b802da>>
*/

"use strict";
Expand Down Expand Up @@ -54,12 +54,11 @@ var ReactNoopUpdateQueue = {
enqueueReplaceState: function () {},
enqueueSetState: function () {}
},
assign = Object.assign,
emptyObject = {};
assign = Object.assign;
function Component(props, context, updater) {
this.props = props;
this.context = context;
this.refs = emptyObject;
this.refs = {};
this.updater = updater || ReactNoopUpdateQueue;
}
Component.prototype.isReactComponent = {};
Expand All @@ -82,7 +81,7 @@ ComponentDummy.prototype = Component.prototype;
function PureComponent(props, context, updater) {
this.props = props;
this.context = context;
this.refs = emptyObject;
this.refs = {};
this.updater = updater || ReactNoopUpdateQueue;
}
var pureComponentPrototype = (PureComponent.prototype = new ComponentDummy());
Expand Down Expand Up @@ -683,7 +682,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-canary-966142ac";
exports.version = "19.0.0-canary-64485d5e";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6f6e375fce9d0700434f863f70f0e2e5ea180426
b039be627dd7403d7d2f63a48c8d263d955ce456
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<077c2c0ff9555d4a76d629316b424c88>>
* @generated SignedSource<<e23105fe3f0439fc7cd9d5143f2ae9f4>>
*/

'use strict';
Expand Down Expand Up @@ -13963,7 +13963,14 @@ function mountClassInstance(workInProgress, ctor, newProps, renderLanes) {
var instance = workInProgress.stateNode;
instance.props = newProps;
instance.state = workInProgress.memoizedState;
instance.refs = {};

{
// When string refs are used in create-react-class legacy components,
// we need to make refs writable unless we patch all such copies of the
// class code that sets to a frozen emptyObject.
instance.refs = {};
}

initializeUpdateQueue(workInProgress);
var contextType = ctor.contextType;

Expand Down Expand Up @@ -26059,7 +26066,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-canary-4b13525c';
var ReactVersion = '19.0.0-canary-e93cff57';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<326542d2f2bb8bbc5fb69f5994f1ea0f>>
* @generated SignedSource<<eb0c79f9647d9ccb19601e79d168e28a>>
*/

'use strict';
Expand Down Expand Up @@ -14202,7 +14202,14 @@ function mountClassInstance(workInProgress, ctor, newProps, renderLanes) {
var instance = workInProgress.stateNode;
instance.props = newProps;
instance.state = workInProgress.memoizedState;
instance.refs = {};

{
// When string refs are used in create-react-class legacy components,
// we need to make refs writable unless we patch all such copies of the
// class code that sets to a frozen emptyObject.
instance.refs = {};
}

initializeUpdateQueue(workInProgress);
var contextType = ctor.contextType;

Expand Down Expand Up @@ -26474,7 +26481,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-canary-2d608505';
var ReactVersion = '19.0.0-canary-f458e15c';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down

0 comments on commit dee0c82

Please sign in to comment.