From c456912d0b4568cd58469ac04bbfd0206d8e0cba Mon Sep 17 00:00:00 2001 From: sebmarkbage Date: Mon, 19 Feb 2024 16:55:09 +0000 Subject: [PATCH] [Flight] Warn if this argument is passed to .bind of a Server Reference (#28380) This won't ever be serialized and is likely just a mistake. This should be covered by the "use server" compiler since it ensures that something that accepts a "this" won't be allowed to compile and if it doesn't accept it, TypeScript should ideally forbid it to be passed. So maybe this is unnecessary. DiffTrain build for [65a0e2b25ec4642f83c32d7599b5252c3955a60b](https://github.com/facebook/react/commit/65a0e2b25ec4642f83c32d7599b5252c3955a60b) --- compiled/facebook-www/REVISION | 2 +- compiled/facebook-www/__test_utils__/ReactAllWarnings.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index c85010c4d934a..60be7417650c6 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -9444c51c7e44936c24e1f44db905cfd45c51cff3 +65a0e2b25ec4642f83c32d7599b5252c3955a60b diff --git a/compiled/facebook-www/__test_utils__/ReactAllWarnings.js b/compiled/facebook-www/__test_utils__/ReactAllWarnings.js index 62d6a4bfefa55..8fdc83e5d0028 100644 --- a/compiled/facebook-www/__test_utils__/ReactAllWarnings.js +++ b/compiled/facebook-www/__test_utils__/ReactAllWarnings.js @@ -105,6 +105,7 @@ export default [ "Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?", "Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", "Can't perform a React state update on a component that hasn't mounted yet. This indicates that you have a side-effect in your render function that asynchronously later calls tries to update the component. Move this work to useEffect instead.", + "Cannot bind \"this\" of a Server Action. Pass null or undefined as the first argument to .bind().", "Cannot call startTransition while rendering.", "Cannot find single active touch.", "Cannot hydrate Suspense in legacy mode. Switch from ReactDOM.hydrate(element, container) to ReactDOMClient.hydrateRoot(container, ).render(element) or remove the Suspense components from the server rendered components.",