Skip to content

Commit 9622d5f

Browse files
committed
Update docs to reflect that top-level updatable fragment spreads are allowed
Remove the "known type hole" bullet point from the website docs that stated updatable fragments cannot be spread at the top level. Also update the code comment in the validator to remove the outdated restriction.
1 parent 629cfc3 commit 9622d5f

2 files changed

Lines changed: 0 additions & 2 deletions

File tree

compiler/crates/relay-transforms/src/assignable_fragment_spread/validate_updatable_fragment_spread.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ impl UpdatableFragmentSpread<'_> {
6464
/// Validate many conditions for spreads of updatable fragments:
6565
/// * the fragment spread contains no directives
6666
/// * there is no @if or @skip between the linked field and the fragment spread
67-
/// * the fragment spread is not at the top level
6867
/// * the fragment's type is a superset or equal to the outer type
6968
/// * this ensures that if we read this fragment with readUpdatableFragment,
7069
/// the result is guaranteed to be valid, i.e. the concrete type is guaranteed

website/docs/guided-tour/updating-data/imperatively-modifying-store-data.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ function NameUpdater({ queryRef }: {
269269
270270
* This particular example can be rewritten using `readUpdatableFragment`. However, you may prefer `readUpdatableQuery` for several reasons:
271271
* You do not have ready access to a fragment reference, e.g. if the call to `commitLocalUpdate` is not obviously associated with a component.
272-
* You do not have ready access to a fragment where we select the **parent record** of the record we wish to modify (e.g. the `Query` in this example). Due to a known type hole in Relay, **updatable fragments cannot be spread at the top level.**
273272
* You wish to use variables in the updatable fragment. Currently, updatable fragments reuse the variables that were passed to the query. This means that you cannot, for example, have an updatable fragment with fragment-local variables and call `readUpdatableFragment` multiple times, each time passing different variables.
274273
275274
<DocsRating />

0 commit comments

Comments
 (0)