Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Relay Modern API notes

Eloy Durán edited this page Sep 15, 2017 · 1 revision

These are areas we ran into where the docs are lacking:

  • container:

    • setting default variable values (use @argumentDefinitions)
    • fields used in different fragments with different arguments lead to a clash, Relay no longer seems to automatically alias those fields like it did in Classic mode, so you need to manually alias those
  • refetch container:

    • passing arguments for parameters defined with @argumentDefinitions (use `@arguments)
  • pagination container:

    • setting the initial page size (use @argumentDefinitions to set default values, although that still means you may need to repeat the count constant in both JS code and the GraphQL fragment)
    • what the purpose of the various functions is (e.g. getFragmentVariables vs getVariables etc)
  • mutations:

    • For connections, still need to provide a mutation ‘config’, but it’s no longer used to append/prepend a new record to the prop and used to re-render, only for how to update the store, I think? Instead we now have to use the imperative API to trigger a UI update.
Clone this wiki locally