From 7c2b460aa41eefd0a48cee966843ed14233674f7 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Fri, 11 Oct 2024 12:21:03 -0700 Subject: [PATCH] Update description of dangerously_unaliased_fixme directive Reviewed By: gordyf Differential Revision: D64254100 fbshipit-source-id: b3719f92942880d183fb2c772d017ac419669942 --- .../relay-schema/src/relay-extensions.graphql | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/compiler/crates/relay-schema/src/relay-extensions.graphql b/compiler/crates/relay-schema/src/relay-extensions.graphql index 5b07d7b48bdb7..0dd0ce921dba1 100644 --- a/compiler/crates/relay-schema/src/relay-extensions.graphql +++ b/compiler/crates/relay-schema/src/relay-extensions.graphql @@ -318,9 +318,17 @@ directive @alias(as: String) on FRAGMENT_SPREAD | INLINE_FRAGMENT """ (Relay Only) -This directive allows users to opt out of validation which enforces that @alias -be used on all fragment spreads which might not match. It is intended as an -escape hatch for incremental adoption of enforcing `@alias`. +**To resolve, replace `@dangerously_unaliased_fixme` with `@alias`** + +This fragment spread will only conditionally be fetched, either due to +`@skip`/@include` or its type condition. Conditionally fetched fragments without +an `@alias` are unsafe because they don't expose any mechanism for the user to +check if the data was fetched before using the fragment. In these cases `@alias` +will materialize the fragment as a nullable named property, ensuring the proper +null checks are performed. + +We now require all such fragment spreads to use `@alias`, and have marked +existing unsafe spreads with `@dangerously_unaliased_fixme`. DO NOT ADD NEW USES OF THIS DIRECTIVE.