From 773818139931bf38e359cccf091a0a873151b2fd Mon Sep 17 00:00:00 2001 From: Sam Zhou Date: Thu, 5 Dec 2024 14:26:01 -0800 Subject: [PATCH] [flow] Drop experimental prefix for partial ref as prop support Summary: React 19 is released. The partial support implementation hasn't changed for a while so let's announce it. Changelog: [feature] Support for React 19's ref-as-prop model is now available via `react.ref_as_prop=partial_support`, and this is now the default. (To disable it, use `react.ref_as_prop=disabled`.) Under this mode, ref prop in jsx will be treated as a regular prop for function components, but utility types like `React.ElementConfig<...>` still won't include the regular ref prop yet. Reviewed By: panagosg7 Differential Revision: D66831536 fbshipit-source-id: 7dc00943a8da947276273dd942b7512fd6ac447b --- src/commands/config/flowConfig.ml | 3 ++- tests/component_syntax/.flowconfig | 1 + tests/component_type/.flowconfig | 1 + tests/react_ref_as_prop/.flowconfig | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/commands/config/flowConfig.ml b/src/commands/config/flowConfig.ml index 6d148b4103e..0b0bc730843 100644 --- a/src/commands/config/flowConfig.ml +++ b/src/commands/config/flowConfig.ml @@ -261,7 +261,7 @@ module Opts = struct node_resolver_root_relative_dirnames = [""]; pattern_matching_expressions = None; react_custom_jsx_typing = false; - react_ref_as_prop = Options.ReactRefAsProp.Disabled; + react_ref_as_prop = Options.ReactRefAsProp.PartialSupport; react_runtime = Options.ReactRuntimeClassic; recursion_limit = 10000; relay_integration = false; @@ -1132,6 +1132,7 @@ module Opts = struct [ ("disabled", Options.ReactRefAsProp.Disabled); ("experimental.partial_support", Options.ReactRefAsProp.PartialSupport); + ("partial_support", Options.ReactRefAsProp.PartialSupport); ] (fun opts react_ref_as_prop -> Ok { opts with react_ref_as_prop }) ); diff --git a/tests/component_syntax/.flowconfig b/tests/component_syntax/.flowconfig index c14bdad3421..3618333f35e 100644 --- a/tests/component_syntax/.flowconfig +++ b/tests/component_syntax/.flowconfig @@ -5,6 +5,7 @@ experimental.react_rule=deepReadOnlyProps experimental.react_rule=rulesOfHooks all=true no_flowlib=false +react.ref_as_prop=disabled [lints] nested-component=error diff --git a/tests/component_type/.flowconfig b/tests/component_type/.flowconfig index 1ee70b81d37..bc887cc1c2b 100644 --- a/tests/component_type/.flowconfig +++ b/tests/component_type/.flowconfig @@ -2,6 +2,7 @@ component_syntax=true all=true no_flowlib=false +react.ref_as_prop=disabled [lints] internal-type=off diff --git a/tests/react_ref_as_prop/.flowconfig b/tests/react_ref_as_prop/.flowconfig index 03ead4c1eaf..b82a9cde983 100644 --- a/tests/react_ref_as_prop/.flowconfig +++ b/tests/react_ref_as_prop/.flowconfig @@ -2,4 +2,4 @@ all=true no_flowlib=false react.runtime=automatic -react.ref_as_prop=experimental.partial_support +react.ref_as_prop=partial_support