What relay objects should implement `Node`?

https://facebook.imtqy.com/relay/graphql/objectidentification.htm it is very clear what it is Nodeand how it behaves, but it does not indicate which objects should implement it, or what are the consequences if your object does not implement it . Is there a feature set that doesn't work? Are such objects completely ignored? Not all objects of the existing specification (for example, pageInfo) implement it, so it is clearly not generally accepted, but it pageInfois a special case.

+4
source share
1 answer

Another way of thinking about the interface Nodeis that the objects that implement it are refined. Well-being effectively means that the object has an identifier that I can use to identify the object and obtain it; by convention, these identifiers will usually be opaque, but will contain information about the type and identifier in that type (for example, Base-64 encoding of a string, for example, “Account: 1234”).

The relay will use reselection in two ways:

  • , "", , QWNjb3VudDoxMjM0 (, name address), , (location, createdAt), Relay , "" node, .
  • , Relay diff Node, (: , location , ). , Relay first + after , , , Node .

, , pageInfo Node, .

+3

Source: https://habr.com/ru/post/1625517/


All Articles