Skip to content

Commit

Permalink
Remove warning for ref cleanup function (#28883)
Browse files Browse the repository at this point in the history
Resources
- RFC: reactjs/rfcs#205
- Warning implemented in #22313
- Warning enabled in #23145
- Feature added in #25686

We have warned to prevent the old behavior since 18.0.0.

The new feature has been on in canary for a while but still triggering
the warning. This PR cleans up the warning for 19

DiffTrain build for [db913d8](db913d8)
  • Loading branch information
jackpope committed Apr 22, 2024
1 parent 3755ebb commit 5d6e662
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 112 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5b903cdaa94c78e8fabb985d8daca5bd7d266323
db913d8e17db25045e0518f3621f1640f2390525
14 changes: 3 additions & 11 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = '19.0.0-www-classic-ff6202ef';
var ReactVersion = '19.0.0-www-classic-426e3043';

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -18314,28 +18314,20 @@ function safelyDetachRef(current, nearestMountedAncestor) {
}
}
} else if (typeof ref === 'function') {
var retVal;

try {
if (shouldProfile(current)) {
try {
startLayoutEffectTimer();
retVal = ref(null);
ref(null);
} finally {
recordLayoutEffectDuration(current);
}
} else {
retVal = ref(null);
ref(null);
}
} catch (error) {
captureCommitPhaseError(current, nearestMountedAncestor, error);
}

{
if (typeof retVal === 'function') {
error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current));
}
}
} else {
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
ref.current = null;
Expand Down
14 changes: 3 additions & 11 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = '19.0.0-www-modern-3c131a55';
var ReactVersion = '19.0.0-www-modern-dd5be59c';

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down Expand Up @@ -17819,28 +17819,20 @@ function safelyDetachRef(current, nearestMountedAncestor) {
}
}
} else if (typeof ref === 'function') {
var retVal;

try {
if (shouldProfile(current)) {
try {
startLayoutEffectTimer();
retVal = ref(null);
ref(null);
} finally {
recordLayoutEffectDuration(current);
}
} else {
retVal = ref(null);
ref(null);
}
} catch (error) {
captureCommitPhaseError(current, nearestMountedAncestor, error);
}

{
if (typeof retVal === 'function') {
error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current));
}
}
} else {
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
ref.current = null;
Expand Down
14 changes: 3 additions & 11 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -22578,28 +22578,20 @@ function safelyDetachRef(current, nearestMountedAncestor) {
}
}
} else if (typeof ref === 'function') {
var retVal;

try {
if (shouldProfile(current)) {
try {
startLayoutEffectTimer();
retVal = ref(null);
ref(null);
} finally {
recordLayoutEffectDuration(current);
}
} else {
retVal = ref(null);
ref(null);
}
} catch (error) {
captureCommitPhaseError(current, nearestMountedAncestor, error);
}

{
if (typeof retVal === 'function') {
error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current));
}
}
} else {
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
ref.current = null;
Expand Down Expand Up @@ -30828,7 +30820,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-www-classic-f994293c';
var ReactVersion = '19.0.0-www-classic-0e9d3a50';

function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
implementation) {
Expand Down
14 changes: 3 additions & 11 deletions compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -26923,28 +26923,20 @@ function safelyDetachRef(current, nearestMountedAncestor) {
}
}
} else if (typeof ref === 'function') {
var retVal;

try {
if (shouldProfile(current)) {
try {
startLayoutEffectTimer();
retVal = ref(null);
ref(null);
} finally {
recordLayoutEffectDuration(current);
}
} else {
retVal = ref(null);
ref(null);
}
} catch (error) {
captureCommitPhaseError(current, nearestMountedAncestor, error);
}

{
if (typeof retVal === 'function') {
error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current));
}
}
} else {
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
ref.current = null;
Expand Down Expand Up @@ -38735,7 +38727,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-www-modern-f079875a';
var ReactVersion = '19.0.0-www-modern-1cc22151';

function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
implementation) {
Expand Down
14 changes: 3 additions & 11 deletions compiled/facebook-www/ReactDOMTesting-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -22709,28 +22709,20 @@ function safelyDetachRef(current, nearestMountedAncestor) {
}
}
} else if (typeof ref === 'function') {
var retVal;

try {
if (shouldProfile(current)) {
try {
startLayoutEffectTimer();
retVal = ref(null);
ref(null);
} finally {
recordLayoutEffectDuration(current);
}
} else {
retVal = ref(null);
ref(null);
}
} catch (error) {
captureCommitPhaseError(current, nearestMountedAncestor, error);
}

{
if (typeof retVal === 'function') {
error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current));
}
}
} else {
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
ref.current = null;
Expand Down Expand Up @@ -31384,7 +31376,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-www-classic-5a00c38b';
var ReactVersion = '19.0.0-www-classic-153fbc4e';

function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
implementation) {
Expand Down
14 changes: 3 additions & 11 deletions compiled/facebook-www/ReactDOMTesting-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -27054,28 +27054,20 @@ function safelyDetachRef(current, nearestMountedAncestor) {
}
}
} else if (typeof ref === 'function') {
var retVal;

try {
if (shouldProfile(current)) {
try {
startLayoutEffectTimer();
retVal = ref(null);
ref(null);
} finally {
recordLayoutEffectDuration(current);
}
} else {
retVal = ref(null);
ref(null);
}
} catch (error) {
captureCommitPhaseError(current, nearestMountedAncestor, error);
}

{
if (typeof retVal === 'function') {
error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current));
}
}
} else {
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
ref.current = null;
Expand Down Expand Up @@ -39423,7 +39415,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-www-modern-d0cd454d';
var ReactVersion = '19.0.0-www-modern-572232e1';

function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
implementation) {
Expand Down
14 changes: 3 additions & 11 deletions compiled/facebook-www/ReactReconciler-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -19851,28 +19851,20 @@ function safelyDetachRef(current, nearestMountedAncestor) {
}
}
} else if (typeof ref === 'function') {
var retVal;

try {
if (shouldProfile(current)) {
try {
startLayoutEffectTimer();
retVal = ref(null);
ref(null);
} finally {
recordLayoutEffectDuration(current);
}
} else {
retVal = ref(null);
ref(null);
}
} catch (error) {
captureCommitPhaseError(current, nearestMountedAncestor, error);
}

{
if (typeof retVal === 'function') {
error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current));
}
}
} else {
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
ref.current = null;
Expand Down Expand Up @@ -28647,7 +28639,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-www-classic-0d0181ca';
var ReactVersion = '19.0.0-www-classic-43b5b0ab';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down
14 changes: 3 additions & 11 deletions compiled/facebook-www/ReactReconciler-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -19358,28 +19358,20 @@ function safelyDetachRef(current, nearestMountedAncestor) {
}
}
} else if (typeof ref === 'function') {
var retVal;

try {
if (shouldProfile(current)) {
try {
startLayoutEffectTimer();
retVal = ref(null);
ref(null);
} finally {
recordLayoutEffectDuration(current);
}
} else {
retVal = ref(null);
ref(null);
}
} catch (error) {
captureCommitPhaseError(current, nearestMountedAncestor, error);
}

{
if (typeof retVal === 'function') {
error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current));
}
}
} else {
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
ref.current = null;
Expand Down Expand Up @@ -27913,7 +27905,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-www-modern-78a11bf8';
var ReactVersion = '19.0.0-www-modern-50d6f514';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down
14 changes: 3 additions & 11 deletions compiled/facebook-www/ReactTestRenderer-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -16343,28 +16343,20 @@ function safelyDetachRef(current, nearestMountedAncestor) {
}
}
} else if (typeof ref === 'function') {
var retVal;

try {
if (shouldProfile(current)) {
try {
startLayoutEffectTimer();
retVal = ref(null);
ref(null);
} finally {
recordLayoutEffectDuration(current);
}
} else {
retVal = ref(null);
ref(null);
}
} catch (error) {
captureCommitPhaseError(current, nearestMountedAncestor, error);
}

{
if (typeof retVal === 'function') {
error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current));
}
}
} else {
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
ref.current = null;
Expand Down Expand Up @@ -23109,7 +23101,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-www-classic-6c3672cc';
var ReactVersion = '19.0.0-www-classic-ad742ce9';

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

0 comments on commit 5d6e662

Please sign in to comment.