Skip to content

Commit 5d6e662

Browse files
committed
Remove warning for ref cleanup function (#28883)
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)
1 parent 3755ebb commit 5d6e662

12 files changed

+31
-112
lines changed

compiled/facebook-www/REVISION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5b903cdaa94c78e8fabb985d8daca5bd7d266323
1+
db913d8e17db25045e0518f3621f1640f2390525

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

+3-11
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function _assertThisInitialized(self) {
6363
return self;
6464
}
6565

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

6868
var LegacyRoot = 0;
6969
var ConcurrentRoot = 1;
@@ -18314,28 +18314,20 @@ function safelyDetachRef(current, nearestMountedAncestor) {
1831418314
}
1831518315
}
1831618316
} else if (typeof ref === 'function') {
18317-
var retVal;
18318-
1831918317
try {
1832018318
if (shouldProfile(current)) {
1832118319
try {
1832218320
startLayoutEffectTimer();
18323-
retVal = ref(null);
18321+
ref(null);
1832418322
} finally {
1832518323
recordLayoutEffectDuration(current);
1832618324
}
1832718325
} else {
18328-
retVal = ref(null);
18326+
ref(null);
1832918327
}
1833018328
} catch (error) {
1833118329
captureCommitPhaseError(current, nearestMountedAncestor, error);
1833218330
}
18333-
18334-
{
18335-
if (typeof retVal === 'function') {
18336-
error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current));
18337-
}
18338-
}
1833918331
} else {
1834018332
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
1834118333
ref.current = null;

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

+3-11
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function _assertThisInitialized(self) {
6363
return self;
6464
}
6565

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

6868
var LegacyRoot = 0;
6969
var ConcurrentRoot = 1;
@@ -17819,28 +17819,20 @@ function safelyDetachRef(current, nearestMountedAncestor) {
1781917819
}
1782017820
}
1782117821
} else if (typeof ref === 'function') {
17822-
var retVal;
17823-
1782417822
try {
1782517823
if (shouldProfile(current)) {
1782617824
try {
1782717825
startLayoutEffectTimer();
17828-
retVal = ref(null);
17826+
ref(null);
1782917827
} finally {
1783017828
recordLayoutEffectDuration(current);
1783117829
}
1783217830
} else {
17833-
retVal = ref(null);
17831+
ref(null);
1783417832
}
1783517833
} catch (error) {
1783617834
captureCommitPhaseError(current, nearestMountedAncestor, error);
1783717835
}
17838-
17839-
{
17840-
if (typeof retVal === 'function') {
17841-
error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current));
17842-
}
17843-
}
1784417836
} else {
1784517837
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
1784617838
ref.current = null;

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

+3-11
Original file line numberDiff line numberDiff line change
@@ -22578,28 +22578,20 @@ function safelyDetachRef(current, nearestMountedAncestor) {
2257822578
}
2257922579
}
2258022580
} else if (typeof ref === 'function') {
22581-
var retVal;
22582-
2258322581
try {
2258422582
if (shouldProfile(current)) {
2258522583
try {
2258622584
startLayoutEffectTimer();
22587-
retVal = ref(null);
22585+
ref(null);
2258822586
} finally {
2258922587
recordLayoutEffectDuration(current);
2259022588
}
2259122589
} else {
22592-
retVal = ref(null);
22590+
ref(null);
2259322591
}
2259422592
} catch (error) {
2259522593
captureCommitPhaseError(current, nearestMountedAncestor, error);
2259622594
}
22597-
22598-
{
22599-
if (typeof retVal === 'function') {
22600-
error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current));
22601-
}
22602-
}
2260322595
} else {
2260422596
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
2260522597
ref.current = null;
@@ -30828,7 +30820,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
3082830820
return root;
3082930821
}
3083030822

30831-
var ReactVersion = '19.0.0-www-classic-f994293c';
30823+
var ReactVersion = '19.0.0-www-classic-0e9d3a50';
3083230824

3083330825
function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
3083430826
implementation) {

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

+3-11
Original file line numberDiff line numberDiff line change
@@ -26923,28 +26923,20 @@ function safelyDetachRef(current, nearestMountedAncestor) {
2692326923
}
2692426924
}
2692526925
} else if (typeof ref === 'function') {
26926-
var retVal;
26927-
2692826926
try {
2692926927
if (shouldProfile(current)) {
2693026928
try {
2693126929
startLayoutEffectTimer();
26932-
retVal = ref(null);
26930+
ref(null);
2693326931
} finally {
2693426932
recordLayoutEffectDuration(current);
2693526933
}
2693626934
} else {
26937-
retVal = ref(null);
26935+
ref(null);
2693826936
}
2693926937
} catch (error) {
2694026938
captureCommitPhaseError(current, nearestMountedAncestor, error);
2694126939
}
26942-
26943-
{
26944-
if (typeof retVal === 'function') {
26945-
error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current));
26946-
}
26947-
}
2694826940
} else {
2694926941
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
2695026942
ref.current = null;
@@ -38735,7 +38727,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
3873538727
return root;
3873638728
}
3873738729

38738-
var ReactVersion = '19.0.0-www-modern-f079875a';
38730+
var ReactVersion = '19.0.0-www-modern-1cc22151';
3873938731

3874038732
function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
3874138733
implementation) {

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

+3-11
Original file line numberDiff line numberDiff line change
@@ -22709,28 +22709,20 @@ function safelyDetachRef(current, nearestMountedAncestor) {
2270922709
}
2271022710
}
2271122711
} else if (typeof ref === 'function') {
22712-
var retVal;
22713-
2271422712
try {
2271522713
if (shouldProfile(current)) {
2271622714
try {
2271722715
startLayoutEffectTimer();
22718-
retVal = ref(null);
22716+
ref(null);
2271922717
} finally {
2272022718
recordLayoutEffectDuration(current);
2272122719
}
2272222720
} else {
22723-
retVal = ref(null);
22721+
ref(null);
2272422722
}
2272522723
} catch (error) {
2272622724
captureCommitPhaseError(current, nearestMountedAncestor, error);
2272722725
}
22728-
22729-
{
22730-
if (typeof retVal === 'function') {
22731-
error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current));
22732-
}
22733-
}
2273422726
} else {
2273522727
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
2273622728
ref.current = null;
@@ -31384,7 +31376,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
3138431376
return root;
3138531377
}
3138631378

31387-
var ReactVersion = '19.0.0-www-classic-5a00c38b';
31379+
var ReactVersion = '19.0.0-www-classic-153fbc4e';
3138831380

3138931381
function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
3139031382
implementation) {

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

+3-11
Original file line numberDiff line numberDiff line change
@@ -27054,28 +27054,20 @@ function safelyDetachRef(current, nearestMountedAncestor) {
2705427054
}
2705527055
}
2705627056
} else if (typeof ref === 'function') {
27057-
var retVal;
27058-
2705927057
try {
2706027058
if (shouldProfile(current)) {
2706127059
try {
2706227060
startLayoutEffectTimer();
27063-
retVal = ref(null);
27061+
ref(null);
2706427062
} finally {
2706527063
recordLayoutEffectDuration(current);
2706627064
}
2706727065
} else {
27068-
retVal = ref(null);
27066+
ref(null);
2706927067
}
2707027068
} catch (error) {
2707127069
captureCommitPhaseError(current, nearestMountedAncestor, error);
2707227070
}
27073-
27074-
{
27075-
if (typeof retVal === 'function') {
27076-
error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current));
27077-
}
27078-
}
2707927071
} else {
2708027072
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
2708127073
ref.current = null;
@@ -39423,7 +39415,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
3942339415
return root;
3942439416
}
3942539417

39426-
var ReactVersion = '19.0.0-www-modern-d0cd454d';
39418+
var ReactVersion = '19.0.0-www-modern-572232e1';
3942739419

3942839420
function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation.
3942939421
implementation) {

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

+3-11
Original file line numberDiff line numberDiff line change
@@ -19851,28 +19851,20 @@ function safelyDetachRef(current, nearestMountedAncestor) {
1985119851
}
1985219852
}
1985319853
} else if (typeof ref === 'function') {
19854-
var retVal;
19855-
1985619854
try {
1985719855
if (shouldProfile(current)) {
1985819856
try {
1985919857
startLayoutEffectTimer();
19860-
retVal = ref(null);
19858+
ref(null);
1986119859
} finally {
1986219860
recordLayoutEffectDuration(current);
1986319861
}
1986419862
} else {
19865-
retVal = ref(null);
19863+
ref(null);
1986619864
}
1986719865
} catch (error) {
1986819866
captureCommitPhaseError(current, nearestMountedAncestor, error);
1986919867
}
19870-
19871-
{
19872-
if (typeof retVal === 'function') {
19873-
error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current));
19874-
}
19875-
}
1987619868
} else {
1987719869
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
1987819870
ref.current = null;
@@ -28647,7 +28639,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
2864728639
return root;
2864828640
}
2864928641

28650-
var ReactVersion = '19.0.0-www-classic-0d0181ca';
28642+
var ReactVersion = '19.0.0-www-classic-43b5b0ab';
2865128643

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

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

+3-11
Original file line numberDiff line numberDiff line change
@@ -19358,28 +19358,20 @@ function safelyDetachRef(current, nearestMountedAncestor) {
1935819358
}
1935919359
}
1936019360
} else if (typeof ref === 'function') {
19361-
var retVal;
19362-
1936319361
try {
1936419362
if (shouldProfile(current)) {
1936519363
try {
1936619364
startLayoutEffectTimer();
19367-
retVal = ref(null);
19365+
ref(null);
1936819366
} finally {
1936919367
recordLayoutEffectDuration(current);
1937019368
}
1937119369
} else {
19372-
retVal = ref(null);
19370+
ref(null);
1937319371
}
1937419372
} catch (error) {
1937519373
captureCommitPhaseError(current, nearestMountedAncestor, error);
1937619374
}
19377-
19378-
{
19379-
if (typeof retVal === 'function') {
19380-
error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current));
19381-
}
19382-
}
1938319375
} else {
1938419376
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
1938519377
ref.current = null;
@@ -27913,7 +27905,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
2791327905
return root;
2791427906
}
2791527907

27916-
var ReactVersion = '19.0.0-www-modern-78a11bf8';
27908+
var ReactVersion = '19.0.0-www-modern-50d6f514';
2791727909

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

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

+3-11
Original file line numberDiff line numberDiff line change
@@ -16343,28 +16343,20 @@ function safelyDetachRef(current, nearestMountedAncestor) {
1634316343
}
1634416344
}
1634516345
} else if (typeof ref === 'function') {
16346-
var retVal;
16347-
1634816346
try {
1634916347
if (shouldProfile(current)) {
1635016348
try {
1635116349
startLayoutEffectTimer();
16352-
retVal = ref(null);
16350+
ref(null);
1635316351
} finally {
1635416352
recordLayoutEffectDuration(current);
1635516353
}
1635616354
} else {
16357-
retVal = ref(null);
16355+
ref(null);
1635816356
}
1635916357
} catch (error) {
1636016358
captureCommitPhaseError(current, nearestMountedAncestor, error);
1636116359
}
16362-
16363-
{
16364-
if (typeof retVal === 'function') {
16365-
error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current));
16366-
}
16367-
}
1636816360
} else {
1636916361
// $FlowFixMe[incompatible-use] unable to narrow type to RefObject
1637016362
ref.current = null;
@@ -23109,7 +23101,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
2310923101
return root;
2311023102
}
2311123103

23112-
var ReactVersion = '19.0.0-www-classic-6c3672cc';
23104+
var ReactVersion = '19.0.0-www-classic-ad742ce9';
2311323105

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

0 commit comments

Comments
 (0)