Relay is a JavaScript framework for building data-driven React applications.

Related tags

UI Framework relay
Overview

Relay · GitHub license npm version

Relay is a JavaScript framework for building data-driven React applications.

  • Declarative: Never again communicate with your data store using an imperative API. Simply declare your data requirements using GraphQL and let Relay figure out how and when to fetch your data.
  • Colocation: Queries live next to the views that rely on them, so you can easily reason about your app. Relay aggregates queries into efficient network requests to fetch only what you need.
  • Mutations: Relay lets you mutate data on the client and server using GraphQL mutations, and offers automatic data consistency, optimistic updates, and error handling.

See how to use Relay in your own project.

Example

The relay-examples repository contains an implementation of TodoMVC. To try it out:

git clone https://github.com/relayjs/relay-examples.git
cd relay-examples/todo
yarn
yarn build
yarn start

Then, just point your browser at http://localhost:3000.

Contribute

We actively welcome pull requests, learn how to contribute.

Users

We have a community-maintained list of people and projects using Relay in production.

License

Relay is MIT licensed.

Thanks

We'd like to thank the contributors that helped make Relay in open source possible.

The open source project relay-hooks allowed the community to experiment with Relay and React Hooks, and was a source of valuable feedback for us. The idea for the useSubscription hook originated in an issue on that repo. Thank you @morrys for driving this project and for playing such an important role in our open source community.

Thank you for helping make this possible!

Comments
  • Make Relay work with React Native out of the box

    Make Relay work with React Native out of the box

    The remaining steps are:

    • [x] Relay/React Native/fbjs versioning
    • [x] Use the appropriate unstableBatchedUpdates depending on React/React Native
    • [x] Version of fetch polyfill for React Native
    • [ ] Document the use of babel-relay-plugin with React Native (see discussion at https://github.com/facebook/relay/pull/714#issuecomment-181204627)
    • [x] Create a fresh React Native project, set up Relay, configure the plugin per the documentation added in the previous step, and make sure everything works as expected.

    Note: edited by @josephsavona

    enhancement help wanted 
    opened by qingfeng 199
  • Language plugin support.

    Language plugin support.

    Closes #2073. Closes #1710.

    In preparation for https://github.com/facebook/relay/issues/2073 and as requested by @kassens, this adds language plugin support to relay-compiler.

    The whole plugin aspect is really just a matter of consolidating all language specific APIs in the RelayLanguagePluginInterface.js file and moving all of the pre-existing JS/Flow related code around to conform to that plugin interface. i.e. nothing should have changed in the existing JS/Flow handling.

    The one actual additions are:

    • making relay-runtime able to load artifacts that are ES6 modules (with default exports)
    • the ability to store all artifacts in a single directory (artifactDirectory), such that fragment references can easily be imported from other artifacts without the need for the Haste module system. i.e. all imports assume the imported module is a sibling of the requesting module. This should also improve the experience of JS/Flow users.

    With this plugin infrastructure in place, @kastermester and I have been able to build a TypeScript plugin https://github.com/relay-tools/relay-compiler-language-typescript. (You can find example artifacts here.)


    Things that are left to do:

    • [x] Document all of the types in the plugin interface
    • [x] Remove version changes from package.json files
    • [x] Rebase on latest upstream master
    • [x] Verify that before and after JS/Flow artefacts are identical

    But these are not critical to being able to start reviewing and providing feedback.

    Test plan

    • See existing JS plugin in action in this fork of the TODO example app https://github.com/alloy/relay-examples/tree/language-plugin-test/todo
    • See TS plugin in action in the forked TODO example app in the TS plugin repo, by following these steps https://github.com/relay-tools/relay-compiler-language-typescript#installation

    Adding the TS plugin to the TODO example app would require the following:

    1. yarn add relay-compiler-language-typescript --dev
    2. Tell babel-plugin-relay where to find artifacts (assuming you want fragment references to be type checked) in .babelrc:
      {
        "plugins": [
          ["relay", { "artifactDirectory": "./ts/__relay_artifacts__" }],
          // ...
        ],
        // ...
      }
      
    3. Then tell relay-compiler to use the TS plugin and to compile artefacts to the same directory as above:
      relay-compiler --src ./ts/ --schema ./data/schema.graphql --language typescript --artifactDirectory ./ts/__relay_artifacts__
      
    4. Which results in:
      tree ts/__relay_artifacts__/
      ts/__relay_artifacts__/
      ├── AddTodoMutation.graphql.ts
      ├── ChangeTodoStatusMutation.graphql.ts
      ├── MarkAllTodosMutation.graphql.ts
      ├── RemoveCompletedTodosMutation.graphql.ts
      ├── RemoveTodoMutation.graphql.ts
      ├── RenameTodoMutation.graphql.ts
      ├── TodoApp_viewer.graphql.ts
      ├── TodoListFooter_viewer.graphql.ts
      ├── TodoList_viewer.graphql.ts
      ├── Todo_todo.graphql.ts
      ├── Todo_viewer.graphql.ts
      └── appQuery.graphql.ts
      
    CLA Signed 
    opened by alloy 78
  • [meta] New Relay APIs (previously codenamed

    [meta] New Relay APIs (previously codenamed "Relay 2")

    New Relay APIs

    The core team is currently focused on developing the next major version of Relay, which we have been referring to as "Relay 2" as a working title, but which will ultimately be just a new set of APIs within the existing Relay. The new APIs are the best parts of Relay today - co-located GraphQL and React components and a declarative API - but is simpler, faster, and more predictable. This issue is to track our overall progress and give us a place to point people toward information.

    More Information

    • Check out our recent blog post on the state of the project and our goals/plan going forward.
    • @wincent's deep dive explains how Relay 2 works from a technical perspective; check this out if you're curious about the implementation and how it differs from current Relay.
    • @josephsavona's React Rally talk provides an overview of the new APIs from a product developer's perspective, including the types of performance enhancements and API simplifications it unlocks.

    FAQs

    Do I have to relearn everything?

    The core concepts of Relay continue to apply: co-located GraphQL and render logic, a declarative API that lets you specify what data you need, not how to fetch it. If you're familiar with Relay today, the updated Relay should feel familiar, with some rough edges removed (no more Routes, for example, just queries and variables). If you're new to Relay, there will less concepts to learn and, we hope, it should be easier to get started.

    There are definite API differences, but the core concepts are the same and the API changes serve to make Relay simpler and more predictable.

    What is the upgrade path?

    Note that we will continue to support the current API for the foreseeable future - we're using it too! Where possible, we will provide tools to help the community upgrade their own apps. We're currently exploring a limited interoperability API as well as codemods and other tools.

    How can I prepare for the new API?

    In general, the main theme is to reduce dynamic APIs that can prevent Relay from understanding the structure of a query statically (i.e. at build time). Examples of such dynamic APIs in current Relay are:

    • RelayMutation and fat/tracked queries. Future releases will deprecate this API in favor of a static mutation API. We recommend using RelayGraphQLMutation to ease the transition to new mutations.
    • RelayContainer#prepareVariables(). Future releases will deprecate support for this function; the workaround is to use (global) query variables and prepare dynamic values at the Renderer.
    • RelayContainer#initialVariables() with runtime function calls specifically (inline constants/literals such as initialVariables: {count: 10} are static, runtime function calls such as initialVariables: {count: getRuntimeValue()} are not). Future releases will deprecate support for dynamically assigned initial variables. Similar to prepareVariables, a workaround will be to use (global) query variables.

    When will the updates to Relay be released?

    We open source tools that we have proven in production. We're working to refine the product developer experience, finish/polish some features, and ship the first apps using it.

    Where can I learn more / follow progress?

    The best way to follow our progress is to read our meeting notes. We publish these semi-weekly, and are exploring a new format with more detailed status updates about sub-projects. We cannot guarantee that we can always keep this issue up to date, so always see the meeting notes for updates.

    High-Level Tasks

    Below is a high-level overview of the work remaining to release the new APIs and core:

    • [x] Introduce a static mutation API: Relay.GraphQLMutation
    • [x] Poly-fill the new core's public API via the legacy core.
    • [x] Introduce static query APIs (new Renderer and Container variants)
    • [x] Deprecate old query APIs (Relay.RootContainer, Relay.Renderer, Relay.Container)
    • [x] Introduce the new core.
    new-core-api 
    opened by josephsavona 77
  • [meta] Support real-time updates via event subscriptions

    [meta] Support real-time updates via event subscriptions

    Realtime data in GraphQL is something that we and the community are actively exploring. There are many ways to achieve "realtime" or near-realtime updates: polling, "live" queries, or event-based approaches (more on these tradeoffs on the GraphQL blog). Furthermore, there are a variety of transport mechanisms to choose from depending on the platform: web sockets, MQTT, etc.

    Rather than support any one approach directly, we would prefer to allow developers to implement any of these approaches. Therefore, we don't plan to create a RelayMutation-style API for subscriptions. Instead we're working create a "write" API that will make it easy for developers to tell Relay about new data (along the lines of store.write(query, data)). See #559 for more information.

    For now, we recommend checking out @edvinerikson's relay-subscriptions module.

    enhancement help wanted 
    opened by josephsavona 74
  • Fragment issue when committing Mutation

    Fragment issue when committing Mutation

    Hi there,

    I have just implemented a new feature in our product using Relay and it worked like a charm so far. Thank you for your awesome work and for open sourcing Relay!

    Unfortunately I have encountered a tricky issue, that I currently do not know how to circumvent and if it is a bug in relay or if my schema is just programmed in a stupid way. Both options are valid at this point in time... :D

    Situation

    I have page showing a "Claim" that refers to a "Medium". This claim has an applied "Policy" that can be changed by a mutation. All these types implement a common Resource interface. The shortened Schema looks like this.

    interface Resource {
      id: ID!
      name: String
    }
    
    type Claim implements Node, Resource {
      id: ID!
      name: String
      medium: Medium
      policy: Policy
    }
    
    type Medium implements Node, Resource {
      id: ID!
      name: String
      remoteUrl: String
    }
    
    type Policy implements Node, Resource {
      id: ID!
      name: String
    }
    

    The mutation is described as this:

    type Mutation {
      updateClaimPolicy(input: UpdatePolicyInput!): UpdatePolicyPayload
    }
    
    input UpdatePolicyInput {
      id: ID!
      policy: String!
      clientMutationId: String!
    }
    
    type UpdatePolicyPayload {
      claim: Claim
      clientMutationId: String!
    }
    

    The client side mutation code:

    export default class UpdateClaimPolicyMutation extends Relay.Mutation {
    
      // we depend on the claim id, so make sure we get it
      static fragments = {
        claim: () => Relay.QL`
          fragment on Claim {
            id
          }
        `,
      };
    
      getMutation() {
        return Relay.QL`mutation {updateClaimPolicy}`;
      }
    
      getVariables() {
        return { id: this.props.claim.id, policy: this.props.policy._id };
      }
    
      /**
      * All that could change...
      * For now this is only the claims policy and the updater
      */
      getFatQuery() {
        return Relay.QL`
          fragment on UpdatePolicyPayload {
            claim {
              policy
              updatedOn
              updatedBy
            }
          }
        `;
      }
    
      // tell relay how to react to the payload...
      // in this case, update the claim
      getConfigs() {
        return [{
          type: 'FIELDS_CHANGE',
          fieldIDs: {
            claim: this.props.claim.id,
          },
        }];
      }
    
    }
    

    The displaying container has the following (shortened) fragment:

    claim: () => Relay.QL`
          fragment on Claim {
            _id
            medium {
              name
            }
            policy {
              name
            }
        }
        `,
    

    So far everything is fine. I can navigate to the page and update the policy by the given mutation.

    Problem

    I have another page showing a list of occurred activities in the system. An activity has a generic target that can be any type implementing the Resource interface.

    type Activity implements Node {
      id: ID!
      time: DateTime
      user: User
      action: String
      target: Resource
    }
    

    As I need to render the target differently depending on the type, I need to query for different data for different objects.

    const mediumFragment = Relay.QL`
      fragment on Medium {
        name
        remoteUrl
      }
    `;
    
    const claimFragment = Relay.QL`
      fragment on Claim {
        medium {
          ${mediumFragment}
        }
      }
    `;
    
    export default Relay.createContainer(ActivityLine, {
      fragments: {
        activity: () => Relay.QL`
          fragment on Activity {
            id
            time
            user {
              _id
                fullName
            }
            action
            target {
              id
              __typename
              name
              ${mediumFragment}
              ${claimFragment}
            }
          }
        `,
      },
    });
    

    I need both fragments, as the target can either be a Medium directly or a Claim whos medium information I want to get as well.

    This still works fine! But when I show an activity with a claim (and expanded Medium) and then navigate to the claim edit-page (which still works fine btw) and execute the change policy mutation, I get the following error:

    Fragment "F3" cannot be spread here as objects of type "Claim" can never be of type "Medium".

    In the network tab, I see the request to the server asking for a Fragment on Medium, even though the medium is not in the mutation or its fat query.

    "mutation UpdateClaimPolicyMutation($input_0:UpdatePolicyInput!){updateClaimPolicy(input:$input_0){clientMutationId,...F5}} fragment F0 on User{_id,fullName,id} fragment F1 on Claim{id} fragment F2 on Claim{policy{_id,name,id},id} fragment F3 on Medium{id} fragment F4 on Node{id} fragment F5 on UpdatePolicyPayload{claim{policy{_id,id},updatedBy{id,...F0},updatedOn,id,...F1,...F2,...F3,...F4,policy{_id,id},updatedBy{id,...F0},updatedOn,id}}"

    Random Guessing

    I guess the issue is that Relay is internally still tracking the combined queries from activities and the claim edit page and is somehow mixing up the requested fragments. Of course a claim can never be a Medium! But I never asked to do that. I asked to get a Medium-Fragment on a Resource earlier, which might be a Claim. But not both at the same time of course.

    So this seems kind of strange to me. Why would it try to apply the Medium Fragment on the Claim.

    • It only happens when I load the activities first (my guess is tracking of the nodes/queries).
    • And only when I make a mutation.

    Querying the data works without any issue and making the mutation without accessing the activities first also works smoothly.

    Do you have any possibilities to replicate this issue or have any comments how this can be avoided? I wouldn't have a problem to simply "kill" tracked queries from my Activity-List page when I navigate away from it. I do not need any caching or anything else here. But I guess this is not the root-cause in this issue.

    Thank you very much in advance for your support and kind regards, Daniel

    opened by danielgriese 68
  • Implement RelayStore.reset()

    Implement RelayStore.reset()

    The motivating use case here is clearing the cache on logout. We already have an internal task for this (t6995165) but I'm creating this issue for external visibility.

    For now, the workaround is to do a full page refresh on logout. The long-term plan here is #559 - instead of resetting the store, applications will be create new instances of RelayEnvironment when necessary.

    enhancement help wanted 
    opened by wincent 60
  • Support Root Fields w/o Node Mapping

    Support Root Fields w/o Node Mapping

    Problem

    Relay currently only knows how to handle these three types of root fields:

    • Root field with no arguments and queries a single node.
      • e.g. empire queries {id: "123", ...}
    • Root field with one argument and queries a single node.
      • e.g. ship(id: "456") queries {id: "456", ...}
    • Root field with one array argument and queries an array of nodes.
      • e.g. ships(ids: ["456", "789"]) queries [{id: "456", ...}, {id: "789", ...}]

    However, it has become clear that Relay needs to support any kind of root field. For example:

    • Root field with multiple arguments.
    • Root field with no arguments and queries an array of nodes.
    • Root field that is a connection.

    Workaround

    For now, the unsupported use cases can be implemented by creating a "global node", commonly called the viewer. You can then add arbitrary fields to viewer.

    static fragments = {
      viewer: () => Relay.QL`
        fragment on Viewer {
          # Can return an array of users.
          users
        }
      `
    };
    

    Rationale

    Historically, GraphQL (as used internally at Facebook) did not have a root type or root fields. Instead, it had special "root calls" such as node, nodes, me, and usernames. Much of Relay was built on top of this assumption that the "root calls" return nodes.

    For example, when we fetch me and get {id: "123", ...}, we record the association between the me root field and the node with ID of 123. Now, if we ever encounter another query for me, we can check our store for the node with ID of 123 and resolve the query without having to potentially re-fetch all of the fields we already have for me.

    Another example, when we fetch nodes(ids: ["123", "456"]), we record the association between each argument and their respective response nodes. This allows us to fulfill queries for node(id: "123") and node(id: "456") even though we may never have independently queried for either before. (We would also be able to fulfill me if the association from above was established.)

    Next Steps

    • [x] Support literal enum and input object values (#894)
    • [x] Support arbitrary values in root calls (#895)
    • [ ] Define a consistent method for annotating a root argument as "identifying". Identifying arguments have a 1:1 correspondence between the argument value and the id of the response. Currently all root arguments are assumed to be identifying.
    • [ ] Allow arbitrary root calls with or without identifying arguments.
    enhancement help wanted legacy-core-api 
    opened by yungsters 53
  • Relay modern Mutation changes in relay store but doesn't updates the UI

    Relay modern Mutation changes in relay store but doesn't updates the UI

    I don't know if it's an issue, I'm new to Relay.. After doing the mutation in relay modern,

     const mutation = graphql`
           mutation addPostMutation (
           $input: addPostData!
          ) {
               addPost(data: $input) {
               node {
                  id
                  content
           }
          }
         }
       `;
    
        commitMutation(
              environment,
              {
                  mutation,
                 variables,
                  onCompleted: (res) => {
                   console.log(environment)
                   console.log(res)
            },
             onError: err => console.error(err)
          }
         )
    

    when I console.log environment, I can see the newly added post in the relay store, but it's not updated in the UI. However, after refreshing the app, the changes are made. This is my schema.graphql

    schema { query: Root mutation: Mutation }

    type Mutation { addPost(data: addPostData!): addPostMutation }

    input addPostData { userID: String, post: String, tags: [String] }

    type addPostMutation { node: postNode }

    interface Node { id: ID! }

    type postEdges { node: postNode }

    type postNode implements Node { id: ID! content: String }

    opened by saudpunjwani101 51
  • [Modern] Client schema docs and examples

    [Modern] Client schema docs and examples

    Any idea when docs and examples would be available?

    Client Schema Extensions The Relay Modern Core adds support for client schema extensions. These allow Relay to conveniently store some extra information with data fetched from the server and be rendered like any other field fetched from the server. This should be able to replace some use cases that previously required a Flux/Redux store on the side.

    https://facebook.github.io/relay/docs/new-in-relay-modern.html#client-schema-extensions

    docs 
    opened by ivosabev 51
  • [modern] Paginate + Refetch

    [modern] Paginate + Refetch

    I have a case where I need something that is like a combination of the refetch and pagination containers. I want to paginate, but I also want to set search variables.

    In Classic, the fragment container handled this fine. I am struggling with how to approach this. Any pointers?

    opened by miracle2k 46
  • Support for in-memory and device data

    Support for in-memory and device data

    As mentioned in the introductory blog post, we're exploring ways to extend Relay to represent data from multiple sources. These data sources could be in-memory objects, native device APIs, or a (GraphQL) server.

    The goal is to allow a unified programming model for accessing all the information relevant to an application - while also retaining a few important invariants:

    • Components use GraphQL to describe their data dependencies.
    • Given a desired output (e.g. a root container) the framework can statically determine all of the required data inputs (e.g. what to fetch, from where, and in what order).
    • Avoid unnecessary re-computation of intermediate or other derived data.

    Proposed API

    The proposed API for product developers is the same GraphQL fragments that we use today. Products can define a unified schema of all of their data, and query it as you would expect:

    fragment Foo on User {
      name,                     # server field
      drafts(first: 10) {       # client-only field
        edges { node { title } }
      }
    }
    

    Some considerations here are how to namespace fields & types to avoid collisions between different data sources, the API for registering non-server types, and the API for updating non-server data.

    RFC

    We'd appreciate your input about possible use-cases for this feature. Some cases that we have considered are retrieving a list of photos via native devices APIs or storing a list of in-progress drafts/edits.

    enhancement new-core-api 
    opened by josephsavona 44
  • [VSCode] relay-compiler binary not correctly detected in project with PnP

    [VSCode] relay-compiler binary not correctly detected in project with PnP

    The VSCode extensions assumes the compiler binary to be below node_modules/relay-compiler. This assumptions doesn't hold true of course, if the project is using PnP with Yarn 2+ for example.

    Should (or rather can) the extension support such scenarios?

    opened by tobias-tengler 0
  • [VSCode] Commenting doesn't work correctly

    [VSCode] Commenting doesn't work correctly

    When commenting inside of graphql annotated strings, the Relay Extension doesn't correctly comment out the code:

    relay-commenting

    It should be using # to comment out the line.

    The VSCode extension uses vscode-graphql-syntax for syntax highlighting and basic GraphQL editor features. This extension without the Relay extension on top supports commenting correctly. I suspect that the language-configuration.json of vscode-graphql-syntax, which defines the commenting behavior, is somehow blocked or overridden by the Relay extension.

    This could also be a VSCode bug

    opened by tobias-tengler 0
  • [VSCode] Provide autocompletion for compiler configuration

    [VSCode] Provide autocompletion for compiler configuration

    When the VSCode extension is active, it will now autocomplete configuration options of the compiler, both in the relay.config.json and the package.json.

    Single project

    relay-single-project

    Multi project

    relay-multi-project

    CLA Signed 
    opened by tobias-tengler 0
  • Fix LSP on Windows

    Fix LSP on Windows

    For every language server endpoint dealing with documents the code previously checked, whether the incoming file URI was part of the root directory:

    uri.path().starts_with(state.root_dir().to_string_lossy().as_ref())
    

    This works fine on Unix, since paths and URIs are "the same":

    Root directory: /home/user/my-app/ File URI: /home/user/my-app/subdir/file.ts

    For Windows you can see why the simple string startsWith might not suffice:

    Root directory: C:\user\my-app\ File URI: /c/user/my-app/subdir/file.ts

    In order to address this we now first convert the URI to a OS specific file path before doing the startsWith.

    Furthermore dunce is being used to canonicalize paths, preventing paths to be converted to their UNC variant.

    Closes #3918

    CLA Signed 
    opened by tobias-tengler 0
  • Align @defer / @stream compiler assumptions to GraphQL spec

    Align @defer / @stream compiler assumptions to GraphQL spec

    Changes

    @stream

    • Rename initial_count argument to initialCount
    • Allow initial_count argument to be not defined, since the official directive definition specifies it as nullable and with a default value of 0
    • Validate initialCount argument being a non-negative int, if it's defined
    • Make if argument non-null

    @defer

    • Make if argument non-null

    Open questions

    • Should I also change the shape of @stream_connection? I haven't touched its signature yet, since it's not part of the GraphQL specification.
    • Some of the changes in this PR are breaking changes. @stream / @defer are experimental features in OSS, so it shouldn't be a problem to just ship these changes. To my knowledge, Meta should be using these features in production though. Is this a blocker for these breaking changes?

    Closes #4158

    CLA Signed 
    opened by tobias-tengler 0
Releases(v14.1.0)
  • v14.1.0(Jul 27, 2022)

    Relay v14.1.0 adds improvements for existing relay features - primarily fixes and feature compatibility for client extensions and @inline. Thanks to our open source contributors who helped us release the Relay VSCode Extension!

    Added

    [cefab9e1659f] Support for @required and client-edges [90ccda1da4b0] Support @argumentDefinitions in @inline fragments (#3935) [8adcfab3ec11] VS Code: Find references of the Resolver field. [b965299349d1] useClientQuery hook [7d5cc3431891] Add support for resolvers without fragments [8db002fa4120] Support custom scalar arguments that are passed as literals

    Fixed

    [a5d67d6bf677] Add resolvers to the dependency graph (Fix missing resolver fragments in incrmental mode and VS Code) [57f96a133177] Improve error message when you mix up @live and non-live values. [c4dbd26278fa] Remove .js and .ts from require / import (#4002) [cd1e9ae06d11] Fix MutationHandlers on field with args [7e6dbdd6af74] Ensure only one implemntation on interface [055908fb12a2] VS Code: Fix comment blocks to recognize the embedded language inside of a JS file. (#4001) [6a9b0e560e3d] Performance optimizations in the validate_conflicting_selections [fa5a3baa9a8d] Explicitly enumerate unsupported ReaderNode types [9990e6f0bf79] Disallow default values on resolver fields [d42bb7c5a139] VSCode extension pathToRelay doesn't allow relative paths (#3969) [a86323f43c59] Validate conflicting selections in client fields

    Source code(tar.gz)
    Source code(zip)
  • v14.0.0(Jun 8, 2022)

    What's Changed

    Breaking Changes

    • [8bb7478a27d5] Removed compiler CLI arguments: src, schema, artifactDirectory. This simplifies the public API of the compiler. The error message should print helpful message with possible config file, that can be used instead of these CLI arguments.
    • [44d68872f4de] Relay Compiler: Make language configuration option required. In v13, we have default language as flow (or Javascript with Flow comments) for reading and generating artifacts. Majority of the projects in OSS, however, use typescript - in order to detect which language (typescript, JS, or flow) is used in the project we will use this option.
    • [ed53bb095ddd] New compiler validation: Disallow __typename in fragments on query.
    • [20626f2c8501] Make __typename selections within concrete linked fields have a string literal type, instead of the type string.
    • [48ed515dd734] Removed legacy exported type names from generated files. typegen_phase have been removed from the Relay compiler config.

    Added

    • Relay VSCode Extension by @tbezman / collaboration with @captbaritone. Starting with #3858.
      • Please see: https://github.com/facebook/relay/tree/main/vscode-extension#readme for detailed information and installation instructions.
    • Relay Provided Variables
      • Provided variables allow populating a variable with a user-defined function. Unlike normal variables, provided variables are automatically defined for all operations that use them, allowing developer to avoid tedious updates to all the queries that might reference a fragment using the variable. This is helpful for global values such as configuration flags or device settings (pixel ratio).
      • More: https://relay.dev/docs/api-reference/graphql-and-directives/#provided-variables
    • Experimental: Relay Typesafe Updaters
      • New Experimental APIs for updating local data: readUpdatableQuery_EXPERIMENTAL and readUpdatableFragment_EXPERIMENTAL
      • For more details see FAQ: https://relay.dev/docs/guided-tour/updating-data/typesafe-updaters-faq/#what-is-typesafe-updaters
    • Experimental: Relay Resolvers
      • Relay Resolvers is an experimental Relay feature which enables modeling derived state as client-only fields in Relay’s GraphQL graph. For more details see https://relay.dev/docs/guides/relay-resolvers/
    • [901d6570090b] Relay Compiler: Add JavaScript language to Relay Compiler Configuration.
      • Please see: https://github.com/facebook/relay/tree/main/packages/relay-compiler for the list of supported compiler configuration options and CLI arguments.
    • [124435968e54] Support for client-only queries.
    • [80a66c9a828a] Support query variables in @inline fragments (#3933).
    • [271a1621ee6b] Support CommonJS for @no_inline (#3923).
    • [9e717658f00d] Add new enum CustomScalarType to represent custom scalar types in the Relay compiler configuration.
    • [e73b95f5e232] Add new option to support compiling a single project (#3868).
    • [2a9f17f2b3db] support sha256 and md5 for local file persister (#3878)
    • [5e3c7b6d4f41] Build linux arm64 (#3882).
    • [23b4cacf1bd2] Expose Relay schema Extensions (#3859).
    • [f199ededc8a2] Relay Compiler: Enable updatable fragments.
    • [58b335e9b3f8] Relay Compiler: Allow single project configs to specify feature flags (#3840).

    Fixed

    • [e8c9ffe8ded7] Relay Compiler: make LocalPersister include trailing newline (#3938)
    • [384315d7fd55] Report schema location for invalid types (#3924).
    • [141ef0fc4f1d] Avoid bug where watch mode can get stuck in invalid state (#3922).
    • [c48bda9f14f8] Ignore BOM when lexing (#3908).
    • [6cff97d75557] declarative_connection: allow interfaces or objects.
    • [52af6a65c526] Don't flatten fragment spreads with differing directives
    • [5a9d42e62c02] Fix incorrect type generation with @required on plural fragments.
    • [739009f649cd] remove DEPRECATED_GraphQLSubscriptionConfig type.
    • [928728a3ad9f] Relay Compiler: Detect cyclic @inline fragments.
    • [eb0fc26f8483] Hooks: Fix useMutation inFlight race condition (#3841).
    • [2101a7991ff8] Relay Compiler: Sort locally persisted operations (#3835).
    • [9f0dea4ff305] Relay Compiler: Sort unions conditionally.
    • [b04b2b71b3b7] Sort object members in type generation (conditionally) (#3808).
    • [bb7c65fa3268] Relay Compiler: Handle spaces between graphql tag and template. literal.

    Improvements/Misc

    • [9556f2fffc46] Persist explorer state in the URL/local storage (#3930).
    • [dd4805753494] Performance optimizations in selection conflicts validations.
    • [bb8721f2f97d] Quote key names in complex type field argument literals.
    • [4e2030f367ba] Add FAQ page to docs.
    • [c6ecd527ac97] Print fragment variables.
    • [7b6e7f5f47ff] Track directives on argument definitions.

    Full Changelog: https://github.com/facebook/relay/compare/v13.2.0...v14.0.0

    Source code(tar.gz)
    Source code(zip)
  • v13.2.0(Mar 10, 2022)

    Added

    • [0c59b5a3731] Tear out the DELAY_CLEANUP_OF_PENDING_PRELOAD_QUERIES experiment
    • [7207485b8d5] Parse Resolver Definitions from docblocks
    • [a2285b88b77] Create a separate ArtifactContent variant for UpdatableQuery
    • [b211acf401b] Add interface that implements interface to test schema
    • [6565c7c3e46] Document Relay Resolvers
    • [e21d89ea004] always enable ENABLE_QUERY_RENDERER_OFFSCREEN_SUPPORT
    • [5172d1b02f9] Rust crate for pruning fields from type schemas
    • [fde6ec615b5] Start considering docblocks in LSP
    • [e97263f96d5] Support index with suffixes when validating module names (#3805)
    • [d5fadad9c4e] Make path a non-optional field now that we've rolled out the compiler…
    • [2e5799d5493] Include React 18 in peerDependencies (#3829)

    Fixes

    • [a8fd33de702] Added tests that show nested fragment bug (1/2)
    • [a2037ae78c1] Patch edge case: add provided variables to relevant root operations
    • [4801f2b6660] Use default language in CliConfig
    • [d794a41dd26] Fix off by one error
    • [d48778c9486] Add test case for @ module and provided variables (1/2)
    • [8707399a167] Patch for SplitOperation and provided variables (2/2)

    Improvements

    • [01a4499b9c4] Make readUpdatableQuery docs match copy in previous docs
    • [be382cfd4ad] docs: add graphql-ws as a websocket client (#3245)
    • [86e2580d21e] Use $fragmentType instead of $ref in docs
    • [5c1e15b9dcd] Clarify that we are watching not waiting
    • [c978b9770b6] Guard against invalid saved state
    • [e6fc28ada37] add directives support to @argumentDefinitions in graphql-ir
    • [74df20caf55] Update internalAct
    • [4a8ecea1af4] Attach location information to missing field diagnostics
    • [9c9c97812b2] Implement get_all for all IncrementalSources
    • [fa83f1eafda] disallow warnings/errors in QueryResource test
    • [a552532ac3a] Expose ability to extend objects after the schema has been created.
    • [bdbc736710a] Allow marking Relay Resolvers as deprecated
    • [bfe0e65790a] Use better location for invalid Relay Resolver root fragment
    • [1e923be977a] Move suggestion_list to schema
    • [6e8b52f6575] Avoid panic when a query consists of only client extension selections.
    • [453fb0bfd84] Simplify and improve converting common::Location to lsp::Location
    • [095135f0d4a] Remove special handling for go-to-def for Resolvers
    • [dbe2c9f73f8] Support Relay Resolvers on interfaces
    • [21a89d731ed] Suggest alternate type/interface if you pick one that does not exist
    • [764af24d78b] Provide code actions to fix a typo on the interface/type of a Resolver
    • [3da1c01cc4b] Targeted error message/code action when mixing type/interface
    • [635705675f7] Add suggestions with code actions when you typo a fragment name
    • [ee5da1e6230] Add path to Resolver codegen nodes
    • [5b259b118f6] use scoped $FlowFixMes
    • [f01cad28834] Improve hover message for Relay Resolver Fields
    • [47d9d20200d] Catch errors thrown by Relay Resolvers
    • [b8e78ca0fbb] update useLazyLoadQuery docs to remove type argument
    • [7fc1e543722] Report syntax errors on type (without waiting on save)
    • [32d17fa8e89] Refactor RelayModernEnvironment to access the network via public methods
    • [d743943ca74] Avoid duplicate output in the compiler CLI
    • [92bf54779bd] remove unnecessary getRequest calls

    Misc

    • [ebf30bbd487] Remove dead QueryResource Suspense handling
    • [ebce9eb7f68] Remove redundant assertions from QueryResource tests
    • [00b9012398e] Rename and move RelayResolverMetadataSource → DocblockSource
    • [b565fc56ab7] Avoid unused type params
    • [2177e00af51] Make SourceSet and ProjectSet iterable
    • [77f4f791a49] Return docblock sources as part of extract
    • [035e29fb948] Add location to docblock AST
    • [d6ee691846b] Remove unused QueryResource cache APIs
    • [0308bfaf34e] Dedupe selections in react codegen
    • [e3da29b22f9] use disallowWarnings from test utils
    • [80e621f4417] Use disallowWarnings in `FragmentResource with Operation Tracker and …
    • [6ef14e55451] Sub out a crate responsible for parsing docblock AST into information…
    • [559cbb78c45] Parse docblock to ir struct
    • [e4237b386e5] Derive a schema AST from Resolver IR
    • [0cfdd54d432] Use disallowWarnings useBlockingPaginationFragment-test.js and
    • [37387839eb3] disallow console.error
    • [880c82c3347] disallow errors/warns in useLazyLoadQueryNode-test.js
    • [e8b5596cabc] Track embedded source indexes explicitly
    • [7687c7ae86e] Improve test output for relay-docblock
    • [72622e5e88b] Merge SourceSet and ProjectSet
    • [ffce58072b3] Model ProjectSet as a newtype vec
    • [ebf30bbd487] Remove dead QueryResource Suspense handling
    • [6f95ab78616] Update transform test to use source location
    • [9cd3331e569] Cleanup compiler feature flag to enable parsing docblocks
    • [d0806d46982] cleanup ENABLE_QUERY_RENDERER_OFFSCREEN_SUPPORT feature flag
    • [6216580476a] Show guide in internal docs
    • [98162d36249] Add homepage banner in support of Ukraine (#3824)
    • [62f6457cfc3] cleanup usage of interface type for UploadableMap
    • [e2d53b4a54f] cleanup usage of interface type in MutationVariables
    • [625370e2cbb] cleanup usage of interface types
    • [5a7646e0cb3] add disallowWarnings to LazyLoadEntryPointContainerDEEPRECATEDTest
    • [4f3c83cccae] Disallow error/warn in some tests in relay-hooks
    • [605e366622e] Disallow warn/error in loadQuery test
    • [36013ae0b4d] Make SourceText generic
    • [d8530106d08] Move Span::to_range() to TextSource
    • [e75b9094bb0] Port NoFragmentCyclesRule
    • [e02717cb44d] Add a persister for Instagram(distillery)
    • [a758c0deb24] remove unnecessary getFragment calls
    • [83136765cae] small followup cleanup for getFragment/getRequest
    • [3497ce7f963] Shared implementation of disallowWarnings and disallowConsoleErrors
    • [91feecfd489] remove rollout flag for @relay_flow_enum directive (4)

    Experimental

    • [b430570ccc3] Add readUpdatableQuery_EXPERIMENTAL docs about updating linked fields
    • [874ca73ddae] Add optional feature flag to parse docblocks
    • [d2d2d1f2618] React Cache: useLazyLoadQuery and useFragmentInternal implementation
    • [ca31ec10a48] add rollout flag for relay_flow_enum_directive to compiler (1)
    • [3070fa3150c] Fork RelayModernStore and add test
    • [03afd5ea45c] Fork ResolverCache
    • [43c8e82a95c] Sketch out External State Resolvers
    • [e8019de7e9d] Emit different types and Reader AST for Relay Resolvers with @ LiVe in…
    • [8d23f5a1af7] Add new node type for live resolvers.
    • [af7a254c33a] Start to adopt new Reader node type
    • [220c7290389] Rebrand External State Resolvers to Live Resolvers
    • [20208b12632] Add rollout option for sorting typegen output
    • [c7cb886d5b4] Add a ConcreteUpdatableQuery variant to GraphQLTag
    • [2faed63e73e] Do not generate unused ASTs, params for updatable queries

    Full Changelog

    https://github.com/facebook/relay/compare/v13.1.1...v13.2.0

    Source code(tar.gz)
    Source code(zip)
  • v13.1.1(Feb 9, 2022)

    Fixed

    • [b23570e3552] Restore live query in non fb_only (#3790)
    • [af262699b0c] Expose typegenPhase in the single project config file. See release v13.1.0 for more details.

    Full Changelog: https://github.com/facebook/relay/compare/v13.1.0...v13.1.1

    Source code(tar.gz)
    Source code(zip)
  • v13.1.0(Feb 8, 2022)

    Misc

    • [0ad48b395ef6b2163c73f4c48da5e7e18f359ada] removes old aliases in generated files by default. This can be restored temporarily with the compiler config "flowTypegen": "Compat" but projects should migrate to using the updated names (e.g. MyFragment$fragmentType instead of MyFragment$ref.

    Full Changelog

    https://github.com/facebook/relay/compare/v13.0.3...v13.1.0

    Source code(tar.gz)
    Source code(zip)
  • v13.0.3(Feb 7, 2022)

    Fixes

    • [052cf7283cb] [e2888b9c0dc] Documentation Improvements
    • [c12b08cb239] Try to fix validateMutation for __isX fields
    • [2ec85b803d7] Fix null comparison for skip_printing_nulls (#3784)
    • [5a16a250ad3] Fix import fragment spread in @raw_response_type
    • [3e499ed2526] Add test to repro weird @raw_response_type behavior

    Improvements

    • [6be20cb620b] Add a JSON file query persister strategy to relay-compiler (#3666)
    • [f30289fef0d] Print directives on query variable definitions
    • [3c701233f37] Remove unnecessary null values from metadata (#3626)
    • [f8123fd31e7] Update non-mutation documentation
    • [0b5a8b97b4c] New file category: Ignore. To keep some files in __generated__ (or in artifactDirectory) directories
    • [e5acd860aff] Easy content changes to relay mutation docs

    Misc

    • [d7f3efc3271] Bump parking-lot to version 0.12.0
    • [7a3861f2657] add prctl 1.0.0
    • [45126dfef63] Remove worker_count from the OperationPersister interface
    • [da917c9e371] Deploy 0.171.0 to xplat
    • [6649f5f9c8c] Daily common/rust/cargo_from_buck/bin/autocargo
    • [becedd92de6] Intern RelativePath using intern::PathId
    • [2a064054aa9] Fixed Repository Reference in monorepo package.json files (#3467)
    • [0007a66c81d] Update indexmap to 1.8.0
    • [1e51356cf00] Change ImportStatements → TopLevelStatements

    Experimental

    • [a2fdae5938d] Stub out Docblock Parser
    • [8ece9fc2943] LSP: Change default response error code to avoid blocking codeactions
    • [5fd50591af1] LSP: Fix a on-hover message
    • [c29ee16bb07] LSP: Reuse complete func in relay-lsp
    • [ef3efc641ab] LSP: Attach field type in detail field
    • [690d51114be] Provided Variables: Add to docusaurus
    • [9e60e09fcac] Provided Variables: Remove duplicate definition in generated artifacts

    Full Changelog: https://github.com/facebook/relay/compare/v13.0.2...v13.0.3

    Source code(tar.gz)
    Source code(zip)
  • v13.0.2(Jan 28, 2022)

    Fixed

    • [0f842787859] Update v13 docs with recent fixes
    • [d745bdfbb41] Check for existence of global before usage (#3646)
    • [03ed79cbe78] Add support for .gql file extensions for schema files
    • [c594f26e3ee] LSP: Fix sending code actions for incorrect code location
    • [96f8d0da625] fix error message source location (#3745)
    • [8ab1167e903] remove pattern filtering in glob_file_source, change it to walk_dir_file_source
    • [a7f125b308d] Update startCursor and endCursor in Connections.md spec (#2655)
    • [8ac91d7e978] use import instead of require if eager_es_modules = true
    • [f1435c3e3fd] Add build for linux-musl target (#3754)
    • [f82885c1686] Fix grammar error (component access => component accesses) and change fancy ' to simple '
    • [e2eb89ed738] Remove unused import from example (#3747)
    • [1a81c5ec641] Fix small warning in an example from the step by step guide (#3746)
    • [74c7ca62c30] Make clientid field readonly

    Improvements

    • [6f9bb960aab] Added ---validate CLI option (#3771)
    • [cce915c70c7] support providing schemaConfig in single project config files (#3777)
    • [d4d98e48399] Make compiler transforms customizable and applied as a Vec of Transforms (#3701)
    • [449bb89b40a] Replace env_logger by simplelog (#3763)
    • [c88609f705d] add support for multiple warnings in relay-test-utils
    • [34380d127b8] Add defaults to persistConfig.params
    • [4013efffb17] Use Semaphore to limit number of concurrent requests when persisting (#3736)
    • [31c156a5658] remove duplication in deprecated mutation/subscription types
    • [490a77f6589] Use id field name from schema_config in relay-typegen
    • [c564ce3dcae] Improve Persisted Queries documentation (#3512)

    Misc

    • [dbe0cbb69ed] update relay to clap3
    • [c2588c778fc] automatic update for shelljs@^0.8.5
    • [3328e8dda6e] automatic update for [email protected]
    • [edd3214473b] Run npx prettier on README files
    • [436a084dd3c] Deploy v0.170.0 to xplat
    • [aa73c44f544] Start separating out code which determines where files live
    • [11c20f5ff26] Moved fb-only unit tests out of oss
    • [5325cda67b5] Update tokio to 1.15
    • [e4919b17689] Upgrade console to 0.15.0
    • [84868c1948a] move more Relay error messages out of graphql-ir
    • [ed3e82d536e] Bump nanoid from 3.1.23 to 3.2.0 in /website (#3769)
    • [4699f678da7] added validation for operation variable names
    • [699d33cfcde] move Relay error messages out of graphql-ir
    • [0c4108d630d] Make loadEntryPoint from Relay unwrap es6 modules with a default export from a JSResource
    • [010b781d14a] write operation aggregate type in final phase
    • [1fc8122ba19] small refactor in codegen
    • [05ce2e0660c] Update Cargo.lock (#3767)
    • [d9d8783ec7c] update fixture-tests to clap3
    • [2cdc4240636] Enum changes are breaking changes
    • [e01b84041c7] export path_for_artifact from relay-compiler
    • [2e3089c2163] unit test for warnings testing util
    • [128d00b5fbe] Bump shelljs from 0.8.4 to 0.8.5 in /website (#3751)
    • [857a579caa5] Bump follow-redirects from 1.14.4 to 1.14.7 in /website (#3752)
    • [9ebec17f0fb] Custom project config from fixtures
    • [df9621abcf7] Daily common/rust/cargo_from_buck/bin/autocargo
    • [97a0e95d742] Add fb_only features flag to unit-tests in CI (#3741)
    • [9dab3ffd344] Remove default fb_only flag on Relay transforms
    • [720f652f31f] impl std::fmt::Write for FlowWriter and TypescriptWriter

    Experimental

    • [a70cd064379] Add quickfix for @waterfall directive
    • [9ac65f9553d] Require adding @waterfall to Client Edge fields
    • [512583441dc] Fix issues with @requiredwithin Resolvers
    • [454de5bbad3] Provided Variables: Changed function signature
    • [c844a5ba76b] Allow runtime to check @required resolver values
    • [88093de09ab] Warn when a provider function returns different values across calls
    • [d543a7a516a] Provided Variables: Errors for provided variables with conflicting types or modules
    • [309c17ca4c4] Provided Variables: Add DiagnosticsResult to transform
    • [[ebc6c95b166] Rename provided variables using module name
    • [ccde4f790a2] renamed variables in test fixtures
    • [ee374c8e2f0] Ignore field handles for now
    • [f699664f777] Expose metadata about the transformation
    • [3a83ed431fd] Assigning undefined to a singular linked field should not assign null
    • [89d38a0d536] Also explicitly make js a non-updatable field
    • [8da45b00c04] For concrete assignable fragment spreads, always select __typename
    • [d17c0e5920f] Add unit tests for fragment spreads with abstract type conditions
    • [64fb54823ec] Generate correct flowtypes for linked field setters
    • [a1221c1a8f9] Enable @required for Relay Resolvers
    • [d4ab8a1c1b9] Fix binary search in flatbuffer schema
    • [a2b12fd25f5] Introduce assignable fragment validators

    Thank you to all contributors who helped with this release! Special thanks to @ch1ffa for adding many valuable fixes and improvements!

    Full Changelog: https://github.com/facebook/relay/compare/v13.0.1...v13.0.2

    Source code(tar.gz)
    Source code(zip)
  • v13.0.1(Jan 10, 2022)

    Added

    • [4fd06d12a26] Add repersist cli flag (#3722).
    • [c28a45937f0] Added relay video from React conf 2021 (#3716).

    Fixed

    • [dcf2098c642] Typing of fetchQuery to use Query type.
    • [1357c25926f] Ignore target in crates folder (#3723).
    • [b5add1e0369] Fix eagerEsModules flag in babel-plugin-relay (#3724).
    • [c7ca8f5d763] Warn for field extensions in config.

    Experimental

    • [378104f341c] Test in RelayResponseNormalizer.
    • [77073a22a96] Runtime: add provided variables into network layer.
    • [f327738d33e] Runtime: inject provided variables into OperationDescriptor.
    • [e8bf0b68bb2] Always allowing setting data.linked_field = null, even if the linked_field contains no fragment spreads.
    • [4176c0e55c1] Renamed function allRootVariables -> withProvidedVariables.

    Misc

    • [ea06433be93] Using new object! macro where appropriate.
    • [e10dba54b46] Bump copy-props from 2.0.4 to 2.0.5 (#3731).

    Full Changelog: https://github.com/facebook/relay/compare/v13.0.0...v13.0.1

    Source code(tar.gz)
    Source code(zip)
  • v13.0.0(Jan 6, 2022)

    Breaking Changes

    • relay-compiler is now implemented in Rust and it replaced the JS version from v12.
      • The motivation and details for this change are captured here: https://relay.dev/blog/2021/12/08/introducing-the-new-relay-compiler/
      • A few new features that are supported in the new compiler:
        • TypeScript code generation added to the compiler.
        • New directives:
          • @required: Improve the ergonomics of handling null values by declaratively telling Relay to either LOG, THROW, or bubble (NONE) null fields.
          • @no_inline: Disable inlining the fragment when it is used in normalization(query) artifacts. Reduce generated artifacts size if the fragment is used in many places.
        • Support for generic query persisting in the configuration.
      • Breaking changes in the new Relay compiler
        • No field aliases can start with two underscores; these are reserved for internal Relay use.
        • Export query hashes to JSON is removed.
      • The quick instructions on how to use the new compiler are here:
        • https://github.com/facebook/relay/blob/main/packages/relay-compiler/README.md
    • Updates in runtime, React APIs, and generated flow types for better integration with Flow: and a first class support for types in flow for graphql tags. It may break some of the components that rely on the structure of the generated Relay flow-types.
    • Statically flow-type the second parameter passed to updaters, optimistic updaters and commitLocalUpdate; it is now derived from the shape of the mutation and is optional. This type had previously been typed as $FlowFixMe (i.e. any); as a result, adding static types here is a breaking change.
    • Removed relay-config.

    For more details see:

    • https://github.com/facebook/relay/releases/tag/v13.0.0-rc.0
    • https://github.com/facebook/relay/releases/tag/v13.0.0-rc.1
    • https://github.com/facebook/relay/releases/tag/v13.0.0-rc.2

    Changes since RC.2

    Added

    • Allow Node interface id field to be configurable. (#3638)
    • [2ea681cc15e] Add FlatbufferSchema.has_type()

    Fixed

    • [995bb871389] Add include option to single project config file, and warn if it is used.
    • [504b5a893fd] add serde(alias = "exclude") to SingleProjectConfigFile
    • [f0d7395db58] do not panic if query_type is not defined
    • Update refetching-queries-with-different-data.md (#3714)
    • [e0911d6443a] update doc references to renamed props
    • [e959f5ce37d] fix typo in fetch policies
    • [ed24f9d55f9] fix unused variables lints in relay-runtime
    • [a93d9223121] fix test utils for ResolverFragments

    Misc

    • [e0751072c72] Update copyright headers from Facebook to Meta
    • [f16b8dab49f] workaround rust-analyzer bug
    • Remove outdated dependecies from package.json (#3712)
    • [1f0191065b5] Update generate_fixture_tests component on FBS:master
    • [e31cac77f99] auto lint fixes
    • [ebfa5b166a7] autocargo: ctp: depend on pxl instead of re-declaring its crates
    Source code(tar.gz)
    Source code(zip)
  • v13.0.0-rc.2(Dec 29, 2021)


    To install this version, run:

    npm install react-relay@dev relay-runtime@dev
    npm install --save-dev relay-compiler@dev babel-plugin-relay@dev
    

    Or using yarn:

    yarn add relay-runtime@dev react-relay@dev
    yarn add --dev relay-compiler@dev babel-plugin-relay@dev
    

    Fixed

    • [b0c5a84de58] Remove runtime feature flag for @required
    • Correctly extract module names on windows (#3694)
    • [1b30d824171] Use WalkDir to find files if watchman is not available
    • Allow default args on required fields (#3612)
    • Stop @preloadable Typescript code generation from emitting an inline require (#3685)
    • Clean the recordsource in mockClear (#3687)
    • Respect excludes when using glob (#3688)
    • Watch js,jsx files with watchman with typescript (#3684)
    • [863c2301aac] Fix incremental mode bug about undefined operation variable
    • [a1f7aba0494] Matching compiler config and babel plugin options
    • Fix the links of the GraphQL Cursor Connections spec (#3704)
    • Fix markdown in graphql-subscriptions.md (#3702)
    • [18305a101ac] Add fb_only feature for subscription/live query transforms
    • [95f1ed81a54] Update error message for invalid paths in config
    • [b18251f90bf] Update Cargo.toml version when publishing main to NPM (#3709)

    Improvements

    • Add default exclude paths for multi-project config (#3693)
    • Add readme files to packages (#3689)
    • [a8b9c2c1d6a] add overloads for Flow integration to useFragment
    • [73d39b085e0] Switch to faster hasher for maps/sets
    • Change 'three' assumptions to 'two' (#3654)

    Misc

    • [e72ea12c746] Store connection_interface on the project_config
    • [e8dfee9ac1b] Update type emission docs
    • [8e041d3c298] Update dependency of [email protected]
    • [b9adc815bc8] Run build for the test project in github actions (#3696)
    • [5baad8ca214] Move ProjectConfig and some other things to relay-config
    • [c49cb86824d] Upgrade to parking_log 0.11.2 and add feature send_guard
    • [3c45f95763e] typing for useLazyLoadQuery
    • Rebuild OSS test project to use the new flow-typing (#3691)
    • [d4d5f67e734] simple cleanup to bubble errors up
    • [3f8e1c6df7c] Fix typo (nullalbe->nullable) and failed markup section formatting
    • [c4321e3bb2d] extract generated type code to module
    • Bump algoliasearch-helper from 3.4.4 to 3.6.2 in /website (#3652)
    • [14550c8bd80] update license headers
    • [6de307c8fd6] use relative imports inside of relay-runtime
    • [4109d4ad3df] Typegen Config: Rename Phase4 -> Compat, make it default

    Experimental

    • Typesafe Updaters: Add support for client schema extension fields. Typesafe updaters is an unreleased, experimental project to provide a more ergonomic, typesafe interface for writing updaters.

      • [30995390857] Rename fragments from Updatable_x to Assignable_x
      • [09fd08589c4] Add assignable fragment with abstract type to unit test
      • [59c9bc01c1d] Move transform_assignable_fragment_spreads to its own module
      • [45913fccb7f] Add support for client schema extensions in readUpdatableQuery
      • [9a9dc85c3f9] Assert that readUpdatableQuery throws when encountering client schema extensions
      • [24bab365ff2] Rename methods, etc. related to typegen for clarity

    Source code(tar.gz)
    Source code(zip)
  • v13.0.0-rc.1(Dec 8, 2021)

    To install this version, run:

    npm install react-relay@dev relay-runtime@dev
    npm install --save-dev relay-compiler@dev babel-plugin-relay@dev
    

    Or using yarn:

    yarn add relay-runtime@dev react-relay@dev
    yarn add --dev relay-compiler@dev babel-plugin-relay@dev
    

    Fixes

    • Evaluate custom scalars first (#3671) [a0160e80ccb]
    • Generate exact imports when using CommonJS and artifactsDirectory (#3675) [bc03126af3a]
    • Update the way we handle different paths in single project config file. [6eea5a8c97f]

    Improvements

    • Do not gate required directive behind feature flag [964b2e4d81f]
    • Update compiler installation instructions [b67bb55f958]
    • Update persisting docs [15aacb091f9]
    • Add MacOS ARM64 build target to relay-compiler for better M1 Mac support (#3667) [dea3f325ba4]
    • Fixed example of 'Refreshing Fragments' (#3664) [f9065653593]
    • Move updatable fragment errors into own module [a961cf410d5]

    Experimental

    • Provided Variables
      • Add JS module 'require's into generated artifacts [df7335a2b76]
      • Fix provided variables bug in transform [390bf1a55b2]
      • Renamed provided variable directive [7930ab7bd56]
    • GraphMode
      • Handle more node types [7730a5ba299]
      • Add utility to insert GraphMode into a MutableRecordSource [03647ab63d9]
      • Support more node types in transform [65bf22fa45d]

    Misc

    • Use cosmiconfig instead of relay-config (#3678) [4c5ddec8f3d]
    • Remove relay-conifg (#3677) [46a408488a4]
    • Move validation messages out of graphql-ir [d92b9e55814]
    • GitHub Actions: remove redundant tag check [609f32b381c]
    • Shorten codegen code with object! macro [9157236cd7a]
    • Convert more of build_ast.rs to use object! macro [eb45f66e88d]
    • Remove publish_packages, this is moved to GitHub Actions [a4d3c2c6bdf]
    • Update itertools to 0.10.3 [f3f3ebb1d66]

    • Previous Release Notes:: https://github.com/facebook/relay/releases/tag/v13.0.0-rc.0
    • Full Changelog: https://github.com/facebook/relay/compare/v12.0.0...v13.0.0-rc.1
    Source code(tar.gz)
    Source code(zip)
  • v13.0.0-rc.0(Dec 3, 2021)

    The one with compiler implemented in Rust.

    For reference, see the issue: https://github.com/facebook/relay/issues/3180

    To install this version, run:

    npm install react-relay@dev relay-runtime@dev
    npm install --save-dev relay-compiler@dev babel-plugin-relay@dev
    

    Or using yarn:

    yarn add relay-runtime@dev react-relay@dev
    yarn add --dev relay-compiler@dev babel-plugin-relay@dev
    

    Breaking Changes

    • relay-compiler is now implemented in Rust and it replaced the JS version from v12.
      • We'll publish a more detailed blog post with motivation for this migration, technical decisions, and challenges we had with it, and results. TL;DR: The main goal was drastically improve the speed of the build step.
      • A few new features that are supported in the new compiler:
        • TypeScript code generation added to the compiler.
          • https://github.com/facebook/relay/pull/3182 - Thanks @MaartenStaa for the initial implementation!
        • New directives:
          • @required directive: Improve the ergonomics of handling null values by declaratively telling Relay to either LOG, THROW, or bubble (NONE) null fields. See more: https://relay.dev/docs/next/guides/required-directive/
          • @no_inline: Disable inlining the fragment when it is used in normalization(query) artifacts. Reduce generated artifacts size if the fragment is used in many places.
        • Support for generic query persisting in the configuration.
      • Breaking changes in the new Relay compiler
        • Strict validation for conflicting fields in selections.
        • No field aliases can start with two underscores; these are reserved for internal Relay use.
        • In the new version, the support for custom JS transforms/JS Plugins are not implemented.
      • The quick instructions on how to use the new compiler are here:
        • https://github.com/facebook/relay/blob/main/packages/relay-compiler/README.md
    • Updates in runtime, React APIs, and generated flow types for better integration with Flow: and a first class support for types in flow for graphql tags.
      • It may break some of the components that rely on the structure of the generated Relay flow-types.
        • [0a487b60eb3] update Relay's types to use $fragmentSpreads and $fragmentType
        • [9a79039df19] add new $fragmentSpreads name to RelayResolverTestUtils
        • [d2c256f7984] Add ReaderInlineDataFragment to GraphQLTaggedNode
        • [8723bd66007] Add new runtime types
        • [4556f539853] rename FragmentReference to FragmentType
        • [d5fe5d25c62] make __fragmentPropName and __module_component not left-hand optional since they are within type conditions
    • Statically flow-type the second parameter passed to updaters, optimistic updaters and commitLocalUpdate; it is now derived from the shape of the mutation and is optional. This type had previously been typed as $FlowFixMe (i.e. any); as a result, adding static types here is a breaking change.
      • [10c2a88a7f2] Make second parameter to SelectorStoreUpdater have type TMutationResponse instead of $FlowFixMe
      • [df04f8dd9a4] Remove default type parameter (any) from SelectorStoreUpdater
      • [1b8b1883d46] Add type param to SelectorStoreUpdater, with a default type of any
      • [2f04533b9f8] Add MutationParams type param to various structs and methods
      • [9c7301dd294] Inform useMutation callers of payloads
      • [e11a33476b0] Modify the public API of Relay.environment to add executeSubscription method
      • [2f4648edadf] Move MutationParameters to RelayStoreTypes
      • [a8b1e6fdb7d] remove $fragmentRefs from updatable fragment flow types

    Improvements

    • [096d1b43750] Friendly error message if user gets singular/plural wrong in updaters
    • Docs: Fix typo in queries.md (#3602)
    • Cache dependencies in GitHub Actions CI workflow (#3604)
    • website: Fix broken links in the top page (#3613)
    • [c3ad9027a6] Make @required docs public
    • Fix broken links for older website versions (#3655)

    Fixed

    • Fix conflicting field warning when using treatMissingFieldsAsNull (#3615)
    • [fe479fb15f0] Fix useRefetchableFragmentNode fetching with initial environment after actor switch
    • [551dd2d853d] Don't cleanup pending preload queries when you're server rendering

    Experimental

    • TypeSafe Updaters: Initial experimental support for updatable queries and assignable fragments. Add a readUpdatableQuery_EXPERIMENTAL method which allows developers to update data in the store using regular assignment, instead of the existing store mutation APIs.
    • Relay Compiler Explorer
      • [29db2bb340e] New docs page that lets you quickly see the Relay compiler’s output for snippets of GraphQL. It performs the compilation in the browser using a Wasm version of the new Rust compiler.

    Misc

    • [38f1c96e769] Codemod $ElementType/$PropertyType to Indexed Access Types
    • Fix version of the GraphQL.js version to 15.3.0 in babel-plugin-relay (#3628).
    • Bump tmpl from 1.0.4 to 1.0.5 (#3600)
    • Bump axios from 0.21.1 to 0.21.4 in /website (#3595)
    • Fix unit-tests in node v16 (#3608)
    • Adds a README to relay-config (#3656)

    Thank you to all contributors who made this release possible!

    Full Changelog: https://github.com/facebook/relay/compare/v12.0.0...v13.0.0-rc.0

    Source code(tar.gz)
    Source code(zip)
  • v12.0.0(Sep 1, 2021)

    Relay Release Notes - 12.0.0

    Commits: https://github.com/facebook/relay/compare/v11.0.2...main

    About the Release

    This is release contains a long list of new fixes and additions to Relay that was added in the last few months: runtime optimizations, react integration updates, logger updates, internal type-safety, documentation updates, and more.

    It also contains a few small, but possibly, breaking changes. One of which is related to the Abstract Type Refinement, others to the live query behavior.

    The Relay team is continuing work on the new rust-version of the compiler, and VS Code extension. As well as experimenting with the new features: multi-environment runtime support, advanced client-state management APIs. We hope to include these in the upcoming releases.

    Thanks to all contributors for your work and support!

    Breaking

    • Relay Runtime: Promote type refinement to default feature (no flag). In OSS this flag was false by default, but true in internal configuration [2732db54335].
    • useQueryLoader will not cancel network requests, except for live queries [211d6fec01c].
    • useLazyLoadQuery will not cancel network requests, except for live queries [a75da574223].

    Added

    • Add Suspense logging to Relay Network Logger.
    • Add log event for when QueryResource suspends.
    • Add suspense logging when suspending from containers.
    • Add log event for when FragmentResource suspends.
    • Website: First draft of Relay Compiler Playground.
    • React: Support double invoking effects in QueryRenderer.
    • Runtime: Enabled unique subscription root: every response received is now processed in a unique Relay store root.
    • Runtime: Enable batched store updates by default.
    • Runtime: FragmentResource store revision optimization.
    • Add Suspense logging to Relay Network Logger.
    • Add execute.* events to the Relay Logger.
    • Expose various hooks utils from relay-runtime: getPaginationMetadata, getPaginationVariables, getRefetchMetadata, getValueAtPath, type Direction [3b6f70d85fb].

    Fixed

    • React: Subscribe on commit in pagination container.
    • React: Actually subscribe on commit in fragment and refetch containers.
    • React: Prevent tearing in refetch container between render and commit.
    • React: Flip useTransition tuple.
    • React: Update relay useTransition tests.
    • Don’t keep unnecessary ref to props in FragmentSpecResolver.
    • Fix memory leak in containers [5a0c4c6320e].
    • Fix Relay Dev Tools network events.
    • Fix throwing promise from RelayModernFragmentSpecResolver.
    • Add improved type safety to useSubscription API.
    • OperationTracker now exposes pending operations affecting owner; display name for suspense promises are more accurate.
    • Do not re-throw errors for incremental payloads that may invalidate the whole query.
    • Runtime: Make RelayPublishQueue.run a no-op if no pending updates.
    • Runtime: Ship FragmentResource store revision optimization.
    • Check if global exists before calling ErrorUtils (#3465).
    • Fix double _publishQueue.run() in OperationExecutor.
    • Use the provided requestSubscription fn in useSubscription.
    • Code Cleanup: Remove RecordSource/RecordSourceMapImpl indirection.
    • Remove duplicated active observable tracking in _processModuleImportPayload.
    • Do not emit extension in compiler includes (#3518).
    • Check if global exists before using it (#3525).
    • Improve handling of falsy conditions and @skip.
    • Fix a bug in RelayReplaySubject that caused indefinite suspense in React double invoke.
    • Do not read from the store if no onNext callback is provided.
    • Make createOperationDescriptor type safe.
    • Set unique root ID before processing a non-incremental payload.
    • Track store writeEpoch in FragmentResource.
    • Update updater docs to include payload.
    • Small optimization in RelayPublishQueue [6b95ff87f23].
    • Reduce FragmentResource memory usage [bd35151fbe2].
    • Avoid calling environment.lookup when not needed in QueryResource.
    • Release redundant temporary retains when the component commits.
    • Support batched responses in RelayResponseCache.
    • OperationTracker now exposes pending operations affecting owner; display name for suspense promises are more accurate.
    • Rename QueryExecutor to OperationExecutor.
    • Rename transactionID to networkRequestId in log events.
    • Documentation/Website/Typo Fixes: #3439, #3456, #3479, #3492, #3493, 3495 #3517, #3530, #3532, #3535, #3545, #3564, #3566, #3569, #3570, #3576, #3552, #3546, #3550, #3577.

    Misc

    • Update batching async module scheduling [8e3e2106061].
    • Only batch async module payload if there is more than one pending module payload.
    • Add ApplyMutation test for RelayEnvironment.
    • Additional testing for applyMutation.
    • CI: remove node 10 and 15, add node 16 (#3466).
    • Bump lodash from 4.17.20 to 4.17.21 in /packages/babel-plugin-relay (#3482).
    • Bump path-parse from 1.0.6 to 1.0.7 in /packages/babel-plugin-relay (#3559).
    • Update React flow types.
    • Add disallowWarnings(...) to some Relay unit-tests.
    • Remove useCustomizedBatch from runtime.
    Source code(tar.gz)
    Source code(zip)
  • v11.0.2(Apr 15, 2021)

    Added

    • Add Relay CodeSandbox to website [f71d1e2261]
    • Add onSubscribe to CacheConfig [04518570ee]
    • Create operation description with correct cache config in usePreloadedQuery [e0713aa613]

    Improvements

    • Documentation Improvements: (#3446), (#3444), (#3440), [1a502697b8], [e24c5b3235], (#3424), (#3434), (#3420), [509f72b9e0], [6ff941313e], [954681ddb8], (#3435), (#3436), (#3439), [cacce8c5aa], (#3456), (#3453)
    • Improve suspense promise displayName [47be7d6827]
    • Make operationTracker required in QueryExecutor
    • Reduce some boilerplate in RelayModernEnvironment
    • Improved warning reporting in Relay Unit-tests
    • Batch store updates to once per event [07d5f49972]

    Fixed

    • Fix onNext callback in requestSubscription [579b8f257a]

    Misc

    • Rename QueryExecutor to OperationExecutor
    • Remove RelayProfiler from RelayResponseNormalizer.normalize [629419596c]
    • Drop RelayModern prefix from QueryExecutor [edef218ee6]
    • Remove RelayProfiler from RelayModernStore.prototype.lookup and RelayProfiler.instrumentMethods [f4866537ca]
    • RelayProfiler no longer skips methods starting with @ [1bfa996f99]
    • Remove RelayProfiler.instrument [cc2758b88d]
    • Remove support for "*" profile event [6e18b9654d]
    • Rename areEqual{OSS => ArgValues} [b8d2694dbe]
    • Remove fbjs/lib/ErrorUtils Dependency [5ed076ee7a]
    • Remove mapObject [4645888162]
    • Export type for RequiredFieldLogger [5a5f5c7ccb]
    • Replace fbjs/lib/invariant with invariant (#3448) [3982f9dca4]
    Source code(tar.gz)
    Source code(zip)
  • v11.0.1(Mar 24, 2021)

    Fixed

    • Fixed several broken website redirects
    • Store updater directives: do not insert existing node again in connection (#3373)

    Documentation Improvements:

    This release contains a set of updates to the new Relay website. Some of the PRs are listed here explicitly. Thank you for your contributions.

    • Replace preloadQuery with loadQuery (#3412)
    • Remove mutation from the server specification (#3381)
    • Fix markdown issue in fragments.md (#3408)
    • Fix typos in loading-states.md (#3411)
    • Fix typos in docs (#3400)
    • Fix typo in the code example in "Introducing Relay Hooks" (#3399)
    • Update use-mutation.md (#3393)
    • Updated load-query.md (#3391)
    • Update use-pagination-fragment.md (#3392)
    • Fix typos in the "Introducing Relay Hooks" blog post (#3394)
    • Thinking-in-graphql.md small typo (#3386)
    • Fixes typo in docs (#3389)
    • Switch text under headings to be <p> (#3385)
    • Fix markdown issue in use-preloaded-query.md (#3384)
    • Use updated Flow object syntax (#3387)
    Source code(tar.gz)
    Source code(zip)
  • v11.0.0(Mar 9, 2021)

    For our announcement on Relay Hooks, check out our blog posts on relay.dev and Facebook Open Source. For docs, see our updated docs website at relay.dev/docs, and for an update on our upcoming releases, see this issue.

    Breaking

    • New version of fetchQuery:
      • New: New version of fetchQuery now returns a lazy Observable which you can subscribe to. It will perform in-flight request de-duping of identical requests. Ignores any Network Layercaching by default, but supports a [fetchPolicy](https://relay.dev/docs/en/experimental/a-guided-tour-of-relay#fetch-policies) to check data cached in the Relay Store.
      • Deprecated: Previous version of fetchQuery renamed to **** fetchQuery_DEPRECATED. Previous behavior returns a Promise (can’t be observed). No request de-duping.
      • Changes in Exports:
        • react-relay: fetchQuery exported from react-relay now has updated behavior and function signature. To access previous version of fetchQuery, import fetchQuery_DEPRECATED from react-relay or react-relay/legacy.
        • relay-runtime: fetchQuery exported from relay-runtime now has updated behavior and function signature. To access previous version of fetchQuery, import fetchQuery_DEPRECATED from relay-runtime.
    • getDataID was renamed from UNSTABLE_DO_NOT_USE_getDataID. This config option is now stable. It can be passed to the Relay Environment and Relay Store as an option that will be used to compute the Data ID for the given record.
    • Default value for gcReleaseBufferSize is now 10 (previously 0).
      • When a query is manually released, for example when a query component unmounts (QueryRenderer or useLazyLoadQuery), Relay will temporarily retain the query in the “release buffer” until the buffer is full. With a buffer size of 0, released queries would not go into the buffer and would be immediately removed from the store cache.
      • With a default buffer size of 10, this means that queries will remained cached in the store for a longer period of time after they unmount, which allows fetch policies like store-or-network. to actually reuse cached data when navigating back to previously visited views.

    If upgrading from experimental release

    • The default UNSTABLE_renderPolicy is now always “partial”. We don’t expect this to produce any issues, and will only affect you if you are upgrading from an experimental release. This option can still be configured, but we will completely remove it in the upcoming releases.

    Added

    Relay Hooks

    • New Relay Hooks APIs added to react-relay and react-relay/hooks. See this issue for more details.
      • relay-experimental has been removed from the source code, and no new experimental builds will be published to npm.
      • We will share more external communications with the community as well as publish our updated docs once a stable release is published.
    • New version of fetchQuery added. See description in Breaking Changes.

    General

    • Added ConnectionHandler.getConnectionID to make it easier to get a connection ID for usage in updaters or declarative connection mutations (@kyarik: https://github.com/facebook/relay/pull/3332)

    Improvements

    If upgrading from experimental release

    • Hooks are now resilient to React effects being re-invoked (e.g. during Fast Refresh).
    • Un-actionable warning that fired when fragment data was missing without being fetched has been removed.
    • loadQuery accepts a fetchPolicy of 'store-only'
    • loadQuery now warns, instead of throwing, if called during the render phase.

    General

    • getDataID is now a stable config option. See description in Breaking Changes.
    • Default value for gcReleaseBufferSize is now 10. See description in Breaking Changes.
    • ConnectionHandler will no longer create edges with an undefined cursor field. This also applies to edges created via @appendNode or @prependNode. (https://github.com/facebook/relay/pull/3278)
    • Several tests migrated to be compile their graphql with Rust Compiler.

    Fixed

    If upgrading from experimental release

    • If loadQuery is called and no network request is made (i.e. if the data is available in the store and the fetch policy allows it), the query is retained in the environment.
    • loadQuery now includes the network cache config in the operation descriptor that is executed against the environment.
    Source code(tar.gz)
    Source code(zip)
  • v11.0.0-rc.0(Feb 26, 2021)

    To install, run:

    npm install react-relay@dev relay-runtime@dev
    npm install relay-compiler@dev babel-plugin-relay@dev --dev
    

    See this issue for more details on upcoming releases. We will publish our updated docs and website with the next stable release, along with additional external communications with the community.

    The new docs will be more comprehensive, and are still are ongoing updates. In the meantime, in order to access some documentation for the APIs in this RC, you can access our current experimental docs, or manually build the docs in website-v2.

    Breaking

    • New version of fetchQuery:
      • New: New version of fetchQuery now returns a lazy Observable which you can subscribe to. It will perform in-flight request de-duping of identical requests. Ignores any Network Layer caching by default, but supports a fetchPolicy to check data cached in the Relay Store.
      • Deprecated: Previous version of fetchQuery renamed to fetchQuery_DEPRECATED. Previous behavior returns a Promise (can’t be observed). No request de-duping.
      • Changes in Exports:
        • react-relay: fetchQuery exported from react-relay now has updated behavior and function signature. To access previous version of fetchQuery, import fetchQuery_DEPRECATED from react-relay or react-relay/legacy.
        • relay-runtime: fetchQuery exported from relay-runtime now has updated behavior and function signature. To access previous version of fetchQuery, import fetchQuery_DEPRECATED from relay-runtime.
    • getDataID was renamed from UNSTABLE_DO_NOT_USE_getDataID. This config option is now stable. It can be passed to the Relay Environment and Relay Store as an option that will be used to compute the Data ID for the given record.
    • Default value for gcReleaseBufferSize is now 10 (previously 0).
      • When a query is manually released, for example when a query component unmounts (QueryRenderer or useLazyLoadQuery), Relay will temporarily retain the query in the “release buffer” until the buffer is full. With a buffer size of 0, released queries would not go into the buffer and would be immediately removed from the store cache.
      • With a default buffer size of 10, this means that queries will remained cached in the store for a longer period of time after they unmount, which allows fetch policies like store-or-network to actually reuse cached data when navigating back to previously visited views.

    If upgrading from experimental release

    • The default UNSTABLE_renderPolicy is now always “partial”. We don’t expect this to produce any issues, and will only affect you if you are upgrading from an experimental release. This option can still be configured, but we will completely remove it in the upcoming stable release.

    Added

    Relay Hooks

    • New Relay Hooks APIs added to react-relay and react-relay/hooks. See this issue for more details.
      • relay-experimental has been removed from the source code, and no new experimental builds will be published to npm.
      • We will share more external communications with the community as well as publish our updated docs once a stable release is published.
    • New version of fetchQuery added. See description in Breaking Changes.

    General

    • Added ConnectionHandler.getConnectionID to make it easier to get a connection ID for usage in updaters or declarative connection mutations (@kyarik: https://github.com/facebook/relay/pull/3332)

    Improvements

    If upgrading from experimental release

    • Hooks are now resilient to React effects being re-invoked (e.g. during Fast Refresh).
    • Un-actionable warning that fired when fragment data was missing without being fetched has been removed.
    • loadQuery accepts a fetchPolicy of 'store-only'
    • loadQuery now warns, instead of throwing, if called during the render phase.

    General

    • getDataID is now a stable config option. See description in Breaking Changes.
    • Default value for gcReleaseBufferSize is now 10. See description in Breaking Changes.
    • ConnectionHandler will no longer create edges with an undefined cursor field. This also applies to edges created via @appendNode or @prependNode. (https://github.com/facebook/relay/pull/3278)
    • Several tests migrated to be compile their graphql with Rust Compiler.

    Fixed

    If upgrading from experimental release

    • If loadQuery is called and no network request is made (i.e. if the data is available in the store and the fetch policy allows it), the query is retained in the environment.
    • loadQuery now includes the network cache config in the operation descriptor that is executed against the environment.
    Source code(tar.gz)
    Source code(zip)
  • v10.1.3(Jan 22, 2021)

    Improvements

    • Improve testing documentation grammar (#3296)
    • Support multiple edges in @appendEdge and @prependEdge [2425572b1]

    Fixed

    • Display code context for single error, fixes #3318 (#3322)
    • Fix accidental cancelation of network request when using loadQuery APIs [20e8b6b14]
    • loadQuery dedupes requests even before AST is available [4527a5bac]

    Misc

    • Documentation fixes and improvements (#3327)
    • Remove "use strict" directive from ES modules [5d555a4db]
    • Bump node-notifier from 8.0.0 to 8.0.1 (#3301)
    • Convert RelayReader-test.js to use new compiler [c0f0f1088]
    • Convert ReactRelayFragmentContainer-WithFragmentOwnership-test.js to use the new compiler [ff0ad178f]
    • Convert ReactRelayPaginationContainer-test.js to use the new compiler [bede32d3d]
    • Convert ReactRelayRefetchContainer-WithFragmentOwnership-test to use the new compiler [20051f61f]
    Source code(tar.gz)
    Source code(zip)
  • v10.1.2(Dec 15, 2020)

    Improvements

    • Avoid throwing in the DeclarativeMutationHandler when the server returns null [9d31dfbd5]
    • Remove old network event names [5075851cb]

    Fixed

    • Bump ini from 1.3.5 to 1.3.7 (#3293)
    • Bump ini from 1.3.5 to 1.3.7 in /website (#3292)
    • Fix code example typo in homepage (#3290)
    Source code(tar.gz)
    Source code(zip)
  • v10.1.1(Dec 7, 2020)

    Improvements

    • Mark failed network requests on preloaded query references (https://github.com/facebook/relay/commit/f59d71249)
    • Refactor notifying store subscriptions for better consistency update perf (under feature flag) (https://github.com/facebook/relay/commit/ad6532807)

    Fixed

    • Require babel helpers instead of inlining (#3188)
    • Ensure network requests are always logged (https://github.com/facebook/relay/commit/95606c5ed)
    • Memoize the cache config in useMemoOperationDescriptor (https://github.com/facebook/relay/commit/81d24d21a)
    • Remove unstable_next from useLoadMoreFunction (https://github.com/facebook/relay/commit/3242c5800)

    Misc

    • Add missing peer dependency in website/package.json (#3262)
    • Add missing copyright headers (https://github.com/facebook/relay/commit/bc55eb6c8)
    • Refine typescript type generation (https://github.com/facebook/relay/pull/3239)
    • Extract store subscription management into separate module (https://github.com/facebook/relay/commit/d64b57987)
    • Remove link to GraphCool from prerequisites page (#3173)
    • Update website/i18n/en.json (#3261)
    Source code(tar.gz)
    Source code(zip)
  • v10.1.0(Nov 16, 2020)

    Added

    • Added @appendNode and @prependNode declarative mutation directives for inserting a node to connections (#3155) [0fe732dab]
      • Usage: comments @appendNode(connections: $connections, edgeTypeName: "CommentEdgeType") { id }
    • Added @deleteEdge directive for removing the edge from connections (#3177) [01d65b3]
      • Usage: deletedCommentId @deleteEdge(connections: $connections)
    • Added plural support for @deleteRecord directive (#3135) [27f938c2a]
      • Usage: deletedCommentIds @deleteRecord
    • Made scheduleGC a public function inside RelayModernStore (#3167) [97401cb]
    • Added cacheConfig in RequestDescriptor (#3070) … [eb256a3]

    Improvements

    • Remove fragment naming enforcement from JS compiler [ff1c10bc6]

    Fixed

    • Docs: fix typos of the 'A Guided Tour' page (#3236) [e4413bfd0]
    • Fix prependNode and prependEdge in declarative connection [7c836dfc4]
    • Fix warning for plural fragment ref pointing to null data [c1a6831e4]
    • Don't setTimeout in loadQuery in SSR [2da0325e5]
    • Fix @match with __typename: other in MatchContainer [92c8d6821]
    • Fix conflicting field value warning [7e3deb415]
    • Bugfix for validating optimistic updates containing undefined fields … [6a1586d]
    • Dispose nested entrypoints when calling dispose() [d5352a2c9]

    Misc

    • In @relay/react-relay, we now use ^16.9.0 || ^17 as a peerDependency.

    Experimental

    • Added various minor improvements and fixes to the loadQuery API.
    • useQueryLoader now accepts an initial query reference.
    • Prevent usePreloadedQuery from consuming stale cached query refs
    • Stop caching errors at fragment boundaries, which prevented
    • Warn when attempting to use an already disposed PreloadedQuery or PreloadedEntryPoint [187bd3489]
    • Make sure loadQuery requests are deduped when started (vs at render time) [a21b1cb0b]
    • Add Relay log event for when an EntryPointContainer uses an entrypoint component resource [7818bfb2c]
    • Create type utility EntryPointElementConfig [7d0224003]
    • Unsubscribe network requests when releasing temporary retains [933b2800b]
    • Optimize getFragmentIdentifier [ac3a252b6]
    • holdGC for incremental responses in QueryExecutor [b3ecce2da]

    Relay Compiler in Rust

    The Relay team is actively working on the new compiler implemented in Rust. The majority of recent changes you can see in the repo are related to the compiler. This new version won't be included in the release, as we are still working on the migration strategies for our OSS customers.

    Thank you for all outstanding contribution to the Relay compiler (https://github.com/facebook/relay/pull/3182)

    Source code(tar.gz)
    Source code(zip)
  • v10.0.1(Jul 23, 2020)

    Experimental

    • Remove persisted query id invariant from loadQuery (https://github.com/facebook/relay/commit/4b88a13f85380b86408bed3167cd05fa3afe875a)
    • Dispose nested entrypoints when calling dispose() (https://github.com/facebook/relay/commit/d5352a2c9bd5351199db6c959fb9f730c3020e3a)
    Source code(tar.gz)
    Source code(zip)
  • v10.0.0(Jul 13, 2020)

    Breaking

    • Change missing field handlers for “linked” fields to treat null as null. Previously, returning either null or undefined indicated that a value could not be determined, and there was no way to indicate that the field value should be set to null. To indicate "no value can be provided", return undefined instead (f106ca0a4)

    Added

    • New Declarative connection mutations: we added several directives to make common store updates in mutations easier. An updater is no longer required for following cases: @deleteRecord (applied to a field of type ID) will delete the record with the given id from the store. @appendEdge and @prependEdge (applied to a connection edge field) will append or prepend the edge to the listed connections (07ccab7cc, 687d89b4b, 271932432)
    • Precise type refinement: gated by RelayFeatureFlags.ENABLE_PRECISE_TYPE_REFINEMENT. With this feature enabled Relay more accurately models GraphQL semantics around inline fragments and fragment spreads which have a different type than their parent selection. This helps Relay to more accurately determine if a query can be fulfilled from the cache (ie with the ‘store-or-network’ fetch policy) and also more accurately determine if data is missing and that a component should suspend. Generally speaking, the change is observable as fewer false positives where Relay thinks data is “missing” when it isn’t. This feature will be enabled by default in a subsequent release; we recommend enabling it now. (00985e11c, 11bf467ab, ef93983a5, 1e0dba0c6, 331871932, f7ba97018, 08ba6f062, 7c67b4750, 2cf9ac982)
    • Warn if a single GraphQL response contains conflicting values for a given field on the same entity (same DataID) (87520d3ef)
    • Optimize RequestIdentifier. Previously if the query was not persisted this used the full query text, now a hash of the query is used instead (a3acc08d3)
    • Enable parsing of Flow enums (bcd7a81b2)
    • Add the referenced DataIDs in the store.gc log event (adb64b7f0)
    • Garbage collection is now yieldy: the GC mark/sweep yields after processing each unit, restarting if a write to the store occurs (687e332e8)
    • PreloadableQueryRegistry is moved from experimental to relay-runtime (6fe43238a)

    Fixed

    • Fixed fatal in joinArgumentDefinitions (85b44e7e5)
    • Generate a static storageKey on field nodes for lists and objects whose values are all static (34b1dc032)
    • Fix @refetchable query generation for interfaces without own id field (d307b37aa)
    • Avoid a memory leak that can occur in some JS runtimes where Error objects can retain data on the call stack until its stack property is evaluated (2859aa8df)
    • Fix bug with treatMissingFieldsAsNull flag and client extensions (5085aeaf7)
    • Fix a memory leak (8c1e91b22)

    Misc

    • Added internal utility types PreloadPropsOf and VariablesOf (796950edc, f1f784f62)
    • Use isMountedRef internal hook in query and EntryPoint loaders (61c862739)
    • Emit LogEvents for Store publish/notify (60b339ba7)
    • Flow updates: add codes to error suppressions, don’t mix import/require in flowtests (fba793099, 232dd9518)
    • Removed unused request parameter in ResponseNormalizer options (651ced50a)
    • Make RelayError messages parameterized (0e7285428)
    • Print the @defer and @stream directives last (this helps with parity between the JS and Rust compiler output) (7271283f5)
    • Run the SkipRedundantNodes transform on SplitOperation nodes (used for data-driven dependencies) (1bc049e8c)
    • Sort test metadata object keys (9a5cd5c78)
    • Use scheduler to schedule consistency updates outside of QueryExecutor (8af33554d, 315bcf93e)
    • Fixed spelling mistakes: (564310dbf, c472ba337)
    • Cleanup unused code: (fba7c8a47, 92b110b40, 56dc1d680, 681f0cdbf, a9cbabe77, 37ae1e7ff, 292b1e819, 8bb58096c)
    • Update generated label for defer/stream nodes (2ae19c307)
    • Sort keys of objects appearing as default values in arguments (3b8a288a1)
    • Remove plural: false metadata in generated artifacts (487016f6f)
    • Sort type spreads in the generate id transform (3de995a87)
    • Sort metadata on generated artifacts by key (bf5484c36)
    • Remove nonStrictEnums setting for defaultValues (78847c68c)
    • Sort argumentDefinitions in queries generated by RefetchableTransform (c4ec34b8a)
    • Add environmentProviderOptions to PreloadedQuery (2365b0101)
    • Remove unused type in argument definitions (812e0f466)
    • Sort fragment arguments, updated artifacts (b065ae242)
    • Remove number of arguments check for fetch queries (9e292990b)
    • Generated ID fields now have the type from the schema (b63815b82)
    • Rename cacheTime property to fetchTime (57719ccd0)
    • Remove unused fragmentRefPathInResponse argument (251703eae)
    • Ensure cursor/count metadata check is limited to extraVariables in getPaginationVariables (84565d41e)
    • GenerateTypeNameTransform generates non-nullable String type for __typename (b128d82bc)
    • Fix check for whether a type is client type (1ccf069dd)
    • Fix printing indentation of conditions (cdd2c4783)
    • Apply fragment arguments on Defer/Stream node (8d8ba8b3e)
    • Remove ValidateServerOnlyDirectivesTransform from IRTransforms (9593d5736)
    • Remove label arg from @stream_connection (2e2be4cac)
    • Strip compiler-only metadata from generated files (229987890, fddd31b08)
    • Also create a proxy for executeWithSource in RelayModernMockEnvironment (8b3df8c86)
    • fetchQueryDeduped accepts a RequestIdentifier instead of an OperationDescriptor (041c6ecf7)
    • remove type condition from @defer fragments (23300a90c)
    • Add onLoad support to PreloadableQueryRegistry (8242adca0)

    Experimental

    • New useQueryLoader() and useEntryPointLoader() hooks for loading queries and EntryPoints from a component. These hooks wrap the internal loadQuery() and loadEntryPoint() APIs to manage the lifecycle of returned resources (ie, disposing the resources when the component un-mounts) (676660dc8, f512c9f6b, c819d414d, d64fe2664)
    • Misc
      • Relay Hooks: useDebugValue to show fragment/query values (e9135791c)
      • Expose networkCacheConfig in preloaded query references (605ac7fe3)
      • Handle case where loadQuery result is rendered under a different environment (08bb2d2db)
      • Don't expose preloadQuery from relay-experimental (d1c8cb59e)
      • Remove PreloadableQueryRegistry from relay-experimental (not a public API) (52ccd2671)
      • prepareEntryPoint returns void and is deprecated (a5534ea95)
      • Removed (internal) variant of PreloadedEntryPoint (09b823699)
    Source code(tar.gz)
    Source code(zip)
  • v9.1.0(Apr 28, 2020)

    9.1.0

    Added

    • Add option in Environment to handle stripped nulls in payload by [email protected], 2020-04-21 (7a798d16)
    • Added queryCacheExpirationTime option to RelayModernStore. Query data in the Relay store will be treated as stale after expiration (add maxTtl to relay store by [email protected], 2020-04-06 (bb888069c))
    • Change toPromise to complete Observable by [email protected], 2020-04-02 (9ef158d08)
    • make the relay environment not responsible for determining whether it is a server environment by [email protected], 2020-04-01 (d11e6497c)
    • sort object keys alphabetically by [email protected], 2020-03-19 (d3ccdf0e7)
    • Allow duplicate 3D selections w identical fragment+module by [email protected], 2020-03-19 (7b4870f5b)
    • Expose query id in preloaded query references by [email protected], 2020-03-10 (98e5cb66f)
    • MockPayloadGenerator: do not generate data for CLIENT_EXTENSIONS by [email protected], 2020-03-04 (b9f14dbab)

    Fixed

    • rework persisted query re-using by [email protected], 2020-04-02 (adaa938c5)
    • Visit SplitOperation in ApplyFragmentArgumentTransform and SkipUnreachableNodeTransform by [email protected], 2020-04-02 (8cfd01d0f)
    • sort object keys in missing cases by [email protected], 2020-03-31 (3d218a7c5)
    • Move SplitModuleImport transform to Relay Query Transforms Pipeline by [email protected], 2020-03-31 (eb0618472)
    • remove loggerProvider from RelayModernMockEnvironment by [email protected], 2020-03-27 (fa1320c6f)
    • Relay Modern Store: always update the root entry fetch time in notify by [email protected], 2020-03-27 (62a229a75)
    • fix inverted case of sorted object keys rollout by [email protected], 2020-03-25 (6d1d83045)
    • fix missing sort of operation object keys by [email protected], 2020-03-24 (4d62e24d0)
    • Avoid removing directives on inlineFragment in FlattenTransform for printing by [email protected], 2020-03-24 (3b188979b)
    • Stop wrapping FragmentSpread on client type in ClientExtension by [email protected], 2020-03-24 (e8e99c910)
    • Fixed feature flag for containers suspending which should be off by default by [email protected], 2020-03-23 (061a6800b)
    • Fix generated aliases for 3D fields with keys by [email protected], 2020-03-20 (84df7a47b)
    • Enforce that multiple 3D selections per document use a unique key by [email protected], 2020-03-18 (0ace9d3fb)
    • Fix validation of handler arg in @connection validation by [email protected], 2020-03-09 (62a10d806)
    • Add flow types for ReactTestRenderer by [email protected], 2020-03-05 (7be1a84ee)
    • Allow client-side schema extensions in optimisticResponse by [email protected], 2020-03-03 (b00736ea2)
    • Remove existingFragmentNames compat feature by [email protected], 2020-02-27 (a49b2086a)
    • Refactor store release buffer management by [email protected], 2020-02-20 (c8471bf76)
    • Disallow typename on Root by [email protected], 2020-02-18 (793729e7a)

    Misc

    • cleanup @relayRequestID header rollout by [email protected], 2020-04-02 (8d71ae1a2)
    • remove redundant check for node type by [email protected], 2020-04-02 (2edce9f6a)
    • remove sort-object-keys rollout by [email protected], 2020-04-02 (640cf9ce0)
    • Use React.useTransition for relay-experimental tests instead of copied version by [email protected], 2020-03-26 (1befdc085)
    • easy: fix typos in relay modern store by [email protected], 2020-03-23 (a9d891093)
    • add test for explicit null argument (#3047) by [email protected], 2020-03-13 (027fbd10e)
    • Add more snapshots for printing conditions to match Rust tests by [email protected], 2020-03-06 (24180d758)
    • Add 2 JS snapshot tests to SkipRedundantNodesTransform by [email protected], 2020-03-06 (9883c8161)
    • add profilerContext to queryresource.fetch event by [email protected], 2020-02-28 (ac226710b)
    • update getModuleName to skip all extra suffixes in the filename by [email protected], 2020-02-14 (4370cac47)

    Experimental

    • add useSubscription hook by [email protected], 2020-02-26 (42056a786)
    • add fetchPolicy support in fetchQuery by [email protected], 2020-04-06 (7395010b0)
    • Remove unsafe cancelation of query in flight in concurrent mode by [email protected], 2020-04-03 (b96441bdc)
    • Fix recycling of data in FragmentResource::subscribe by [email protected], 2020-02-19 (2093478c8)
    • Fix unsafe tracking of refetch generation in useRefetchableFragment for concurrent mode by [email protected], 2020-04-06 (a8614dd12)
    • Clean up useBlockingPaginationFragment tests for latest React Suspense fixes by [email protected], 2020-03-31 (baa11ce62)
    • Minor cleanup of useBlockingPagination w/ Suspense test by [email protected], 2020-03-31 (754c64ff1)
    • Re-enable Suspense useBlockingPagination test which was accidentally disabled by [email protected], 2020-03-30 (dc47d6f5f)
    • Disallow user defined object to be used in fragmentRef arguments by [email protected], 2020-03-18 (084e16592)
    • Disallow user defined object to be used as key in useFragment by [email protected], 2020-03-17 (b1442b990)
    • Minor refactor of useLazyLoadQuery test by [email protected], 2020-03-06 (5ec8737a6)
    • Fix useMutation with fast refresh by [email protected], 2020-02-24 (86f5456af)
    • Rename useIsParentQueryInFlight to useIsParentQueryActive by [email protected], 2020-02-19 (3794f0bcd)
    • Fix concurrent mode data race when calling loadNext and checking for active request by [email protected], 2020-02-19 (251701d46)
    • Remove extraneous extraOptions field. by [email protected], 2020-02-12 (2b8697733)
    • add queryresource.retain event by [email protected], 2020-03-30 (cc5728744)
    Source code(tar.gz)
    Source code(zip)
  • v9.0.0(Feb 13, 2020)

    9.0.0

    Breaking

    • Rename getModernOperationVariables to getOperationVariables

    Added

    • Added queuePendingOperation to RelayModernMockEnvironment in testing tools. This allows the caller to manually register an operation that should be pending.
    • Optionally output eager es modules (https://github.com/facebook/relay/pull/2781).
    • Expose a way to override isGeneratedFile function via language plugin (https://github.com/facebook/relay/pull/2810).
    • Allow language plugin to specify how generated files should be named (https://github.com/facebook/relay/pull/2866).
    • Allow language plugin to specify how to check for presence of graphql strings (https://github.com/facebook/relay/pull/2811).
    • Setup external config for Relay Compiler.

    Fixed

    • Ensure root record is always created upon store initialization, even before initial query has been processed.
    • Fix disposable of optimistic updates: https://github.com/facebook/relay/commit/87ef4ed101018af40d471061ca546b8f5a326486
    • Fix various issues in docs.
    • Fix loading external config for Relay Compiler (https://github.com/facebook/relay/pull/2999).

    Misc

    • DataChecker::check now returns the operation fetch time.
    • Removed getRelayDefaultMissingFieldHandlers.js

    Experimental

    • Fix leaking environments when using Relay Hooks (https://github.com/facebook/relay/pull/3014).
    • Fix support of Fast Refresh when used with Relay Hooks.
    • Fix recycling data for plural fragments; i.e. return an array with the sam object identity if the data hasn’t changed.
    • Add support for batched @stream’ed responses.
    • Internally renamed useLegacyPaginationFragment to usePaginationFragment.
    • Potentially Breaking
      • preloadQuery will error if called during render.
      • Remove new connection model experimental code.
      • We know check for “active” instead of queries in “flight” when determining when to suspend. An operation may be indefinitely in flight (e.g. a live query, or a GraphQL Subscription), but it’s only “active” if it’s actively receiving payloads, e.g. during @streaming or @defer.
    Source code(tar.gz)
    Source code(zip)
  • v8.0.0(Dec 19, 2019)

    8.0.0

    Commits: https://github.com/facebook/relay/compare/v7.1.0...v8.0.0

    Breaking

    • Relay Compiler no longer relies on the graphql-js schema representation. And consumes only SDL file that represents the schema. This means that all custom implementations relay compiler runners that were depended on the specifics of the graphql-js may not work as expected. Specifically, custom Enum values are no longer available in the relay-compiler - as they cannot be expressed via SDL. Also, custom function parseValue, parseLiteral and serialize that can be defined for a graphql type via graphql-js primitives are not accessible in the relay compiler: this may break serialization of custom scalars. https://github.com/facebook/relay/commit/860c23cbb445e04fd14e5d05ed53a026d4f63357
    • Babel plugin no longer produces thunks: https://github.com/facebook/relay/commit/490c89dfea7513e5624bc7b8c66204078d3b5911
    • Mutations are committed to unique root ids https://github.com/facebook/relay/pull/2349. In mutation updaters, fields in the mutation will no longer be available in the store root returned from store.getRoot. Usages like store.getRoot().getLinkedRecord('create_comment_mutation') will break.
    • Removed internally unused RelayRecordSourceProxy::commitPayload(). Note that this method was not part of the public interface.
    • Signature of RelayStore.retain() changed to directly accept an OperationDescriptor. An operation descriptor to pass to RelayStore.retain()can be constructed usingcreateOperationDescriptoravailable inrelay-runtime`.

    Added

    • Allow language plugin to add schema extensions. https://github.com/facebook/relay/pull/2935
    • In relay-compiler we added support for variables in complex objects and arrays: https://github.com/facebook/relay/commit/5da3be070283c6dcd42774ba33c1590db65fe3c7
    • isClientID helper is available to use in relay-runtime https://github.com/facebook/relay/commit/dac614c4812fc48db9c00d69d81dc1aa0c6231db

    Fixed

    • Remove the clientMutationId requirement by creating a new root id for each executed mutation: https://github.com/facebook/relay/pull/2349

    • validateMutation correctly handles lists of scalar fields in the optimistic payloads: https://github.com/facebook/relay/commit/56795ba6f839e4d770d19b0d921940515db98475

    • DissalowIDAsAlias this validation had a bug, there it wasn't traversing LinkedFields, hence wasn't reporting violations in their selections. https://github.com/facebook/relay/commit/c4547f9a0fd41c28851490d2ba499e0f30831175

    • RelayModernFragmentSpecResolver only holds on to fragment references as opposed to all props passed to product code to reduce amount of leaked memory when rendering in React concurrent mode.

    • Fixed detecting whether the execution environment is a server: https://github.com/facebook/relay/pull/2960

    Misc

    • Relay codebase is using explicit inexact objects: https://github.com/facebook/relay/commit/4e2cc2fde74f5d155c39aff474e19b70e139593e
    • Added an options property on IEnvironment for attaching extra information to the environment instance
    • Updated docs to consider Relay server specifications GraphQL best practices and not purely a Relay spec: https://github.com/facebook/relay/pull/2603
    • https://relay.dev has a new landing page redesign: https://github.com/facebook/relay/pull/2953

    Experimental

    • Data Invalidation: Added new Data Invalidation primitives to allow marking data in the Relay Store as stale. When data is marked as stale, queries that reference that data will also be stale; stale queries will indicate to Relay that they need to be refetched the next time they are evaluated.
    • Deprecate LazyLoadEntryPointContainer => LazyLoadEntryPointContainer_DEPRECATED: https://github.com/facebook/relay/commit/08bde918325336bdaacb444b249ed1dd5a81d30c
    • Removed Unused types from RelayStoreTypes https://github.com/facebook/relay/commit/76354e9015d3c327256a65b2777af0c627b29ca3
    • usePreloadedQuery now takes an unstable UNSTABLE_renderPolicy like useLazyLoadQuery: https://github.com/facebook/relay/commit/fc1b88b9cd59b646444562c8c597308c8cb9f8cd
    • useMutation Hook was added: https://github.com/facebook/relay/commit/96d9703761e222a740cbefbed567e6cfe8015e69
    • Export a JSResource Flow interface from Relay.
    • Fixed subscribing to plural fragments with missing data when using useFragment.
    Source code(tar.gz)
    Source code(zip)
  • v7.1.0(Nov 7, 2019)

    7.1.0

    Added

    • New warning in RelayPublishQueue if if RelayPublishQueue::run() is called again during a run(): https://github.com/facebook/relay/commit/382353481622a26c5cd27473fe88dfe9783926a1
    • Support for the new configuration option in the compiler (https://github.com/facebook/relay/commit/aa1453bb89ef250a54d52ac2de22293576f96a7b) writerConfig.writeQueryParameters - that can accept the function:
    writeQueryParams: (
      dir: CodegenDirectory,
      filename: string,
      moduleName: string,
      params: RequestParameters,
    ) => void
    

    Fixed

    • Compiler: fix validation of required fields with default values #2903 by @mrtnzlml
    • [Allow non-nullable Viewer field in ViewerQueryGenerator #2924 by @janicduplessis
    • Add exports to relay-runtime to make available in relay-experimental: https://github.com/facebook/relay/commit/a0fc1019f07bec45e0a0d887963961a08f24adaf

    Misc

    • Renaming/cleanup in the compiler: Moving some parts of the new codegen runner to OSS, removed redundant prefixes.

    Experimental

    • Allow an extraOptions object on PreloadOptions: https://github.com/facebook/relay/commit/68e893e25c2db1c74a1a366774fe638fb50b0683
    • Allows passing a raw query to preloadQuery(), which makes it usable without the special $Parameters file: https://github.com/facebook/relay/commit/edb46706085a35699197300e6238f022982a2bad
    • getModuleIfRequired replaced with queryResource in the EntryPoints: https://github.com/facebook/relay/commit/32f4a71df153b0ea1b0eb40cf8b164db6cbff2d3
    • Added new Relay Experimental Docs: https://github.com/facebook/relay/commit/3f7ba11c8345030aa0ba46e35f8e72eb363bf348
    • Added Step-by-step guide to Relay Hooks: https://github.com/facebook/relay/commit/2d1473f85264ef3f9df9d209e1b2957c49a02933
    • Add support for loading 3D resources in optimistic responses: https://github.com/facebook/relay/commit/bef3551a2b1d8f8402ec123538e1c118fdbb527c
    Source code(tar.gz)
    Source code(zip)
  • v7.0.0(Oct 21, 2019)

    7.0.0

    Commits: https://github.com/facebook/relay/compare/v6.0.0...v7.0.0

    Breaking

    • Variables are no longer set in Relay Context when using a QueryRenderer. This means that any product code that was relying on reading variables from RelayContext will break. If you need to access the variables that were set at a query root, the recommended approach is to manually pass them down through the component tree in product code.

    • Removed old RelayNetworkLogger, and relay-runtime no longer exports createRelayNetworkLogger. This logger is being replaced with event based logging on the Environment which will allow us to have richer and more contextual events logged with more detail on what's going on. Wrapping the actual network request doesn't work well as some "requests" might never actually end up on the network when they can be fulfilled completely from the store.

    • The constructor signature of Store constructor changed; specifically the second argument to the constructor is now an options object. Any product code directly constructing a Store and passing a second argument will need to be updated.

    • Relay Compiler no longer relies on graphql-js for query validation. Most of the validation rules we used previous are now part of the RelayParser itself, while the remainder and implemented as transforms (https://github.com/facebook/relay/commit/15e8d2201fdad47596e1acfb3a5daa3fb7511a8e). Additionally, we've removed the concept of RelayIRValidations (https://github.com/facebook/relay/commit/da01bf3fc18774115821fc4a33558b51e04a82e4), which ran after IR transformation.

    • @defer is no longer allowed on inline fragments, since we can’t communicate a loading state with Suspense when used on an inline fragment. @defer is now only supported on fragment spreads.

    Added

    • RelayCompiler: added a new directive (https://github.com/facebook/relay/commit/3dd79e859144030158fe996e714ebfd7b16751fd) @DEPRECATED__relay_ignore_unused_variables_error to suppress errors that were surfaced after we've migrated from GraphQL NoUnusedVariablesRule to RelayIRTransform validation. GraphQL NoUnusedVariablesRule was not aware of the difference between root (operation) variables and local fragment variables (defined by @argumentDefinitions) - because of that, it was considering the local fragment variables that have the same name as the root variable as used and did not report the violation. But in Relay compiler, we know this distinction, and we already keep track of the root variables and can report those invalid cases. Unfortunately, this revealed multiple violations that weren't possible to fix without product team involvement. For this purpose, we added a directive that can be used to temporarily suppress the error while teams fix their queries.

    Improved

    • Relaxed the constraint for @refetchable directive on a fragment: we no longer enforce that the argument for the node field is called id; it can be called anything as long as it’s an ID type.
    • Developers can now select the __id field anywhere that __typename can be selected, in order to fetch the internal cache key of an entity. The primary use-case for this is updating records that don’t have an id. Before, updating or deleting such entities would require writing an updater function that traversed from the nearest strong entity (w an id); now, developers can directly target records with e.g. store.get(record.__id) in an updater function.

    Fixed

    • RelayCompiler: Usage of $variables in Complex objects (or as List Items) is now disabled by RelayParser: https://github.com/facebook/relay/commit/6946e85da4f2646db7901790f3ade406c753fd03 This was already unsupported, but Relay previously threw an error later in compilation.
    • MockPayloadGenerator: allow null as default value of enum: https://github.com/facebook/relay/commit/6946e85da4f2646db7901790f3ade406c753fd03
    • Fix display names for containers.
    • Fixed @refetchable connection metadata for custom handlers.
    • Fixed missing field handler behavior for plural linked fields.
    • Fixed getRefetchMetadata to handle both commonjs and esmodules. (#2875)
    • Fixed printing require module dependency in generated artifacts. (#2861)

    Misc

    • Upgraded React peer dependency to 16.9.0.
    • Upgraded babel-preset-fbjs to 3.3.0
    • RelayCompiler: We've changed the field type and typeCondition in GraphQL IR types to use Relay internal representation of GraphQL type (https://github.com/facebook/relay/commit/2606f32674f75513726207ceb198c906c276e90c). Before this change, we were directly using graphql-js type instances. But eventually, our goal in Relay compiler is to get rid of the dependency on the graphql-js schema representation and use a faster/less memory intensive representation of the schema. We also build a Schema wrapper: https://github.com/facebook/relay/commit/9e6d9192d6516e16f0383e7b9094ecded77f1348 - that should help us during this migration.

    Experimental

    • Several performance improvements to the internal implementation of useFragment were shipped.
    • Fixed issue to stop tracking mutations as in flight in the RelayOperationTracker when applying the optimistic update; this caused issues with suspending unexpectedly.
    • Fixed issue to stop tracking GraphQL subscriptions as indefinitely in flight in the RelayOperationTracker; instead, subscriptions should only be tracked as in flight when they’re waiting for incremental or module payloads. This caused issues with suspending indefinitely in some cases.
    • Fixed issue to correctly dispose of ongoing requests when unmounting a useQuery hook; this might happen when useQuery starts a long-lived request, e.g. to poll for real time data.
    • Fixed issue in useQuery to not suspend indefinitely when server response doesn’t return all of the requested data. This might occur for example when making selections on abstract types.
    • Fixed re-establishing store subscriptions when using useBlockingPagination.
    • Fixed pagination with Relay Hooks when using fragments that contain @argumentDefitions.
    • Pagination with Relay Hooks is now allowed even if server returns value for hasNextPage as false.
    • Several improvements to new experimental representation of connections.
    • Temporarily exposed new option for useQuery: renderPolicy_UNSTABLE, which determines whether data should be eagerly or lazily rendered.
    Source code(tar.gz)
    Source code(zip)
  • v6.0.0(Sep 16, 2019)

    Commits: https://github.com/facebook/relay/compare/v5.0.0...v6.0.0

    Breaking

    • Environment no longer supports a configurable PublishQueue, this is a prerequisite for upcoming changes to support a new connection representation and the Store interface changes (see below): https://github.com/facebook/relay/commit/44edf14ea92221643436d51a44dbb7c9dea8e873
    • Changed the Store interface, adding snapshot() and restore() methods and changing the way that PublishQueue/Store coordinate to revert/rebase optimistic updates: https://github.com/facebook/relay/commit/a5c903d9d954ab0af8a273fbb0eb1873540c466b
      • Note: this should have no impact on users who use the default Store implementation; the main impact is to alternate store implementations and consumers thereof.
    • Removed the unused RecordSource interface load() method: https://github.com/facebook/relay/commit/bd15d4e8cf75256c4ba6f07d07652a652c66cfe1
    • Changed dataFrom prop in ReactRelayQueryRenderer to fetchPolicy, changed 'STORE_THEN_NETWORK' to 'store-and-network'.
    • Changed $key in flow type for plural fragments to plural ($ReadOnlyArray<>)
    • environment.unstable_internal has been removed, since we no longer need to support Relay Compat.
    • Minimum required React version is now 16.9.0

    Added

    • Added unreleased relay-experimental package which contains experimental version of Relay Hooks using React Suspense.
    • Added a LocalQueryRenderer that has the same API as QueryRenderer, and only renders from data in the store.
    • @inline directive and readInlineData() function that enables data masking for functions instead of React components.
    • Added an @raw_response_type directive on query, mutation and subscription. With the directive, a new flow type will be added to the generated artifact that represents the shape of the server response.
    • New documentation for Client Schema extensions and managing local data was added.

    Improved

    • Validate that required arguments are provided in compiler.
    • Don't include (https://github.com/facebook/relay/commit/70453f2f0aa356b46225161f05be35594d366e35) @babel (https://github.com/babel) packages in generated bundles ( (https://github.com/facebook/relay/commit/70453f2f0aa356b46225161f05be35594d366e35)#2764 (https://github.com/facebook/relay/pull/2764)) (https://github.com/facebook/relay/commit/70453f2f0aa356b46225161f05be35594d366e35)
    • Made several performance optimizations for our compiler transforms.
    • Allow RelayFileWriter to specify the filesystem object (#2837)
    • Can now configure persistFunction with relay config.

    Fixed

    • Various fixes to the MockPayloadGenerator
      • Added test case for mocking null values (#2762 (https://github.com/facebook/relay/issues/2762))
      • Fixed MockResolvers for Objects in plural fields
      • Fixed generated values for scalar arrays/enums
      • Fixed mock resolvers for arrays of Enums (#2779 (https://github.com/facebook/relay/pull/2779))
      • Handle cases when MockResolver for ID returning undefined
    • Fix edge case in ConnectionHandler when field is unset
    • Fixed relay-compiler babel polyfill problem.
    • Use reporter to report changes (#2838)
    • Use global state for persisted queries to fix --watch (#2625 (https://github.com/facebook/relay/issues/2625))

    Misc

    • v6.0.0 should now be compatible with React 16.9.0.
    • Experimental: work-in-progress support for a new approach to representing connections, with changes starting in https://github.com/facebook/relay/commit/6f0129531caac238b5dc5725819be543c5672388. The new connection representation is not feature complete and disabled by a feature flag. The APIs are highly likely to change.
    • Added a new implementation of the RelayRecordsSource (available behind a feature flag)
    Source code(tar.gz)
    Source code(zip)
  • v5.0.0(Jun 11, 2019)

    Commits: https://github.com/facebook/relay/compare/v4.0.0...v5.0.0

    Breaking

    • react-relay containers no longer consume variables from React context, but instead from fragment owners passed through fragment refs. This means that if you have a custom QueryRenderer or other component that set Relay Context, setting variables on that context will no longer affect descendant components.

    Added

    • Expose ability to pass custom scalar configuration to compiler (#2745 by @alloy)
    • Add relay-config package to manage compiler configs (#2746 by @alloy)

    Improved

    Fixed

    • Updated default compiler configuration to include files from __tests__ directories: https://github.com/facebook/relay/commit/033a4bbc332e3d18c2bd37ebfde5f9f930d9c9e3
    • Fixed a bug in flow type generation that fields on inline fragments with duplicated names are only included once: [088afdf](https://github.com/facebook/relay/commit/088afdf347582533b9956adbc5b2a5e37fe9cfaf)
    • Deduplicate connection edges based on DataID (not just id field)
    • Fixed a bug that mutations on viewer field “overwriting” existing fields in the store: Add hardcoded ID to viewer field

    Misc

    Source code(tar.gz)
    Source code(zip)
Owner
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
Facebook
The tiny framework for building hypertext applications.

Hyperapp The tiny framework for building hypertext applications. Do more with less—We have minimized the concepts you need to learn to get stuff done.

Jorge Bucaran 18.9k Jan 1, 2023
🐰 Rax is a progressive React framework for building universal application. https://rax.js.org

Rax is a progressive React framework for building universal applications. ?? Write Once, Run Anywhere: write one codebase, run with Web, Weex, Node.js

Alibaba 7.8k Dec 31, 2022
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

Supporting Vue.js Vue.js is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome ba

vuejs 201.6k Jan 7, 2023
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

vue-next This is the repository for Vue 3.0. Quickstart Via CDN: <script src="https://unpkg.com/vue@next"></script> In-browser playground on Codepen S

vuejs 34.6k Jan 4, 2023
Ember.js - A JavaScript framework for creating ambitious web applications

Ember.js is a JavaScript framework that greatly reduces the time, effort and resources needed to build any web application. It is focused on making yo

Ember.js 22.4k Jan 4, 2023
:fire: An extremely fast, React-like JavaScript library for building modern user interfaces

Inferno is an insanely fast, React-like library for building high-performance user interfaces on both the client and server. Description The main obje

Inferno 15.6k Dec 31, 2022
Write JSX-driven components with functions, promises and generators.

Crank.js Write JSX-driven components with functions, promises and generators. Documentation is available at crank.js.org. Crank.js is in a beta phase,

null 2.5k Jan 1, 2023
A declarative, efficient, and flexible JavaScript library for building user interfaces.

React · React is a JavaScript library for building user interfaces. Declarative: React makes it painless to create interactive UIs. Design simple view

Facebook 200k Jan 4, 2023
A declarative, efficient, and flexible JavaScript library for building user interfaces.

Solid is a declarative JavaScript library for creating user interfaces. It does not use a Virtual DOM. Instead it opts to compile its templates down t

Ryan Carniato 24.5k Jan 4, 2023
jCore - JavaScript library for building UI components

JavaScript library for building UI components

iOnStage 11 Jan 21, 2022
Dojo Framework. A Progressive Framework for Modern Web Apps

@dojo/framework Dojo is a progressive framework for modern web applications built with TypeScript. Visit us at dojo.io for documentation, tutorials, c

Dojo 549 Dec 25, 2022
🌱 React and redux based, lightweight and elm-style framework. (Inspired by elm and choo)

English | 简体中文 dva Lightweight front-end framework based on redux, redux-saga and react-router. (Inspired by elm and choo) Features Easy to learn, eas

null 16.1k Jan 4, 2023
A declarative, HTML-based language that makes building web apps fun

A declarative, HTML-based language that makes building web apps fun ?? Docs ∙ Try Online ∙ Contribute ∙ Get Support Intro Marko is HTML re-imagined as

Marko 12k Jan 3, 2023
A Web Component compiler for building fast, reusable UI components and static site generated Progressive Web Apps

Stencil: A Compiler for Web Components and PWAs npm init stencil Stencil is a simple compiler for generating Web Components and static site generated

Ionic 11.3k Jan 4, 2023
OpenUI5 lets you build enterprise-ready web applications, responsive to all devices, running on almost any browser of your choice.

OpenUI5. Build Once. Run on any device. What is it? OpenUI5 lets you build enterprise-ready web applications, responsive to all devices, running on al

SAP 2.7k Dec 31, 2022
A blazing fast React alternative, compatible with IE8 and React 16.

Nerv is a virtual-dom based JavaScript (TypeScript) library with identical React 16 API, which offers much higher performance, tinier package size and

null 5.4k Jan 4, 2023
A rugged, minimal framework for composing JavaScript behavior in your markup.

Alpine.js Alpine.js offers you the reactive and declarative nature of big frameworks like Vue or React at a much lower cost. You get to keep your DOM,

Alpine.js 22.5k Jan 2, 2023
A modest JavaScript framework for the HTML you already have

Stimulus A modest JavaScript framework for the HTML you already have Stimulus is a JavaScript framework with modest ambitions. It doesn't seek to take

Hotwire 11.7k Dec 29, 2022
A functional and reactive JavaScript framework for predictable code

Cycle.js A functional and reactive JavaScript framework for predictable code Website | Packages | Contribute | Chat | Support Welcome Question Answer

Cycle.js 10.2k Jan 4, 2023