From e2bb95fc05329b2a2325a29d04ca49d6c6b5ce67 Mon Sep 17 00:00:00 2001 From: jackpope Date: Mon, 22 Apr 2024 15:02:35 +0000 Subject: [PATCH] Remove warning for ref cleanup function (#28883) Resources - RFC: https://github.com/reactjs/rfcs/pull/205 - Warning implemented in https://github.com/facebook/react/pull/22313 - Warning enabled in https://github.com/facebook/react/pull/23145 - Feature added in https://github.com/facebook/react/pull/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 https://github.com/facebook/react/commit/db913d8e17db25045e0518f3621f1640f2390525. --- .../cjs/ReactTestRenderer-dev.js | 16 ++++------------ .../Libraries/Renderer/REVISION | 2 +- .../implementations/ReactFabric-dev.fb.js | 16 ++++------------ .../ReactNativeRenderer-dev.fb.js | 16 ++++------------ 4 files changed, 13 insertions(+), 37 deletions(-) diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js index c0ab6902ae7a0..e757700502aee 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<72055afa4818e8a565d07875c49b2d9d>> */ 'use strict'; @@ -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; @@ -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 diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION index d7ae26c1bbb0d..ec5bdd3366836 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION @@ -1 +1 @@ -368202181e772d411b2445930aea1edd9428b09b +db913d8e17db25045e0518f3621f1640f2390525 diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js index 00c7f089ac591..3b123ddae400d 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<6bbaf37a7e6d0c6b86bd687aa4e09ebe>> + * @generated SignedSource<> */ 'use strict'; @@ -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; @@ -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 diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js index 0e227c6f612be..9772c0dce82d0 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<1c5ee0ee0fef4e85b317999b53699b5f>> + * @generated SignedSource<<067d8fee132e988882b3b0dcb3c6e6da>> */ 'use strict'; @@ -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; @@ -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