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 commit db913d8.
  • Loading branch information
jackpope committed Apr 22, 2024
1 parent faed6ae commit e2bb95f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<fbc5f0d556063e18e8065897a4edae21>>
* @generated SignedSource<<72055afa4818e8a565d07875c49b2d9d>>
*/

'use strict';
Expand Down Expand Up @@ -16185,28 +16185,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 @@ -22986,7 +22978,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-canary-c4e3bea9';
var ReactVersion = '19.0.0-canary-acecb093';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
368202181e772d411b2445930aea1edd9428b09b
db913d8e17db25045e0518f3621f1640f2390525
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<6bbaf37a7e6d0c6b86bd687aa4e09ebe>>
* @generated SignedSource<<d1fd7d33d65e21b9395d92b4c9c241c6>>
*/

'use strict';
Expand Down Expand Up @@ -19444,28 +19444,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 @@ -26056,7 +26048,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-canary-b83624af';
var ReactVersion = '19.0.0-canary-f7d342a2';

/*
* 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<<1c5ee0ee0fef4e85b317999b53699b5f>>
* @generated SignedSource<<067d8fee132e988882b3b0dcb3c6e6da>>
*/

'use strict';
Expand Down Expand Up @@ -19491,28 +19491,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 @@ -26471,7 +26463,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-canary-f6aae78f';
var ReactVersion = '19.0.0-canary-f9159889';

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

0 comments on commit e2bb95f

Please sign in to comment.