Comments (5)
Note that while Relay requires edges
for its pagination, it doesn't have an opinion on whether nodes
is exposed. So if you find nodes
convenient for browsing APIs (I certainly do), I'd definitely add it in! If you do so, Relay has a check in place so that if you query for nodes
instead of edges
, it will warn and suggest querying for edges
instead.
from graphql-relay-js.
We fetch cursors on every edge so that if you have a component that asks for first:10
and have it cached and later another component asks for first:5
, we can generated the correct pageInfo based on the cursors we have fetched from first:10
for first:5
without doing a server round trip.
Another case is, if some of the edges are deleted through mutations, we still have the cursors form the other edges to fetch for additional edges.
from graphql-relay-js.
CC @yuzhi who can describe what the Relay store does with the cursors on each edge, and hence why it uses edges
rather than nodes
.
Internally, we expose nodes
for exactly the reason you describe: if you don't need edge data or the cursor, it's quite convenient to skip straight to the nodes; that's definitely a useful pattern.
from graphql-relay-js.
Yeah, that's what @leebyron suggested on graphql/graphql-spec#4.
Can't what to hear the purpose of that. I'm guessing something related to nodes being evicted out of a local cache and refetching parts of a connection?
from graphql-relay-js.
Interesting thanks!
/cc @modocache @akatz
On Tuesday, September 22, 2015, Yuzhi [email protected] wrote:
We fetch cursors on every edge so that if you have a component that asks
for first:10 and have it cached and later another component asks for
first:5, we can generated the correct pageInfo based on the cursors we
have fetched from first:10 for first:5 without doing a server round trip.
Another case is, if some of the edges are deleted through mutations, we
still have the cursors form the other edges to fetch for additional edges.—
Reply to this email directly or view it on GitHub
#27 (comment)
.
from graphql-relay-js.
Related Issues (20)
- Update master to main HOT 1
- Build error in ./resources/prepublish.sh
- New release? HOT 6
- Return type check problem of mutationWithClientMutationId after 0.7.0 update HOT 3
- Is the peer dependency on graphql exactly 15.5.1 on purpose? HOT 3
- RangeError: Invalid code point HOT 2
- Are filtering operators supported? HOT 1
- isPromise is not a function HOT 3
- Add support for `graphql@v16`
- Can I return a union type on `outputFields`?
- Does anyone use this package with their Nest.js server?
- Merge the `graphql-relay-subcription` into `graphql-relay-js`? HOT 1
- Migrate from `chai` to `jest`?
- 0.10.0 connections causing compile error HOT 3
- To use this plugin is it necessary to get all records from the database with one request?
- filters connectionFromArray HOT 1
- Export pageInfoType
- 0.10.0 has no Flow type support HOT 4
- Make fields on PageInfo type shareable
- Compile error: 'NotSupportedTSVersion.d.ts' is not a module. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-relay-js.