facebook / relay

Relay is a JavaScript framework for building data-driven React applications.
https://relay.dev
MIT License
18.24k stars 1.8k forks source link

Complete @alias #4699

Closed captbaritone closed 1 week ago

captbaritone commented 3 weeks ago

@alias is a directive that I prototyped 2 years ago as part of a hack week. I believe this PR completes the required work to enable it.

  1. Adds documentation
  2. Handles (runtime and types) @required(action: NONE/LOG) bubbling up to a aliased inline fragment
  3. Computes the nullability of aliased fragments based on their types and any @skip/@include directives
  4. Validates that there are no name collisions between field names/aliases and aliased fragments
  5. Adds a feature flag which enforces that @alias is added to all fragments which will conditionally be fetched (this may be difficult to enable)
  6. Support for aliased inline fragments without a type condition
  7. Many compiler and runtime tests

Not in this PR

The following would be nice to have, but are not nessesary to enable the feature as optional.

  1. Ability to mark an aliased fragment as @required or @catch
  2. Tooling/strategies for incrementally enabling enforcement
facebook-github-bot commented 2 weeks ago

@captbaritone has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 1 week ago

@captbaritone merged this pull request in facebook/relay@efab5ab09deb8554b0cdbee85611dd9763e50c26.