-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better support for async connections #80
Comments
Can you use |
Not really, it doesn't easily work out-of-the-box - I believe you have to write the logic which calculates the correct I ended up doing this, takes advantage of the fact that cursors are soley based on the offset and not whatever the array contains: https://github.com/clayallsopp/graphqlhub/pull/29/files; would be happy to open a PR to merge it into |
@clayallsopp have you figured out a clean way to deal with this? I too have a similar case where it's easier for me to fetch exactly the data I need instead of fetching all the data and having the library trim the data after the fact. I think this is rather common (in my case, request a slice of the database collection instead of the entire thing) |
Hey, a pretty common situation is that getting the list of connected IDs is cheap (i.e. the list of the IDs of your friends), but resolving each ID is expensive.
Specifically for this kind of use case: clayallsopp/graphqlhub@07fec4c#diff-6cd9d3d473d2f9b30b961ebfb3d3f048R50 - I have the entire list of IDs in memory, so if the query specifies
first: 5
or provides a cursor, it would be great to reduce the set of IDs we're resolving before we resolve them. the currentconnectionFromPromisedArray
doesnt help in this regard, as you have to resolve the entire list and then it trims after-the-factI think something like this API would be very helpful in general - I think it's possible? (assuming you have the entire list of IDs in memory and cursors are pure functions of offset and IDs)
The text was updated successfully, but these errors were encountered: