You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the case that you have a custom cursor defined via resolveCursor, I would think the generated pageInfo should also be run through it, else the pageInfo.startCursor / pageInfo.endCursor will be the default cursors, not the custom ones.
I actually ended up getting around this issue by generating my own pageInfo from scratch, since in my case connectionFromArray wasn't doing anything special for me (I'm pulling data from a DB, and don't have access to allItems), but if this was an oversight but intended behavior, I thought I'd bring it to light.
export const PostType = new GraphQLObjectType({
name: 'Post',
description: 'Post',
fields: () => ({
id: globalIdField('Post'),
messages: {
type: messageConnection,
args: connectionArgs,
resolve: async (post, args) => {
let messages = await getMessages(post.id, args)
let connection = connectionFromArray(messages, args);
// connection.edges is still using the default cursors, because resolveCursor will only get called after this resolve returns
// likewise, connection.pageInfo.startCursor and connection.pageInfo.endCursor are using the default cursors, but they won't be re-resolved using my custom resolveCursor()
return connection;
},
},
}),
interfaces: [nodeInterface],
});
The text was updated successfully, but these errors were encountered:
In the case that you have a custom cursor defined via
resolveCursor
, I would think the generated pageInfo should also be run through it, else thepageInfo.startCursor
/pageInfo.endCursor
will be the default cursors, not the custom ones.I actually ended up getting around this issue by generating my own pageInfo from scratch, since in my case connectionFromArray wasn't doing anything special for me (I'm pulling data from a DB, and don't have access to allItems), but if this was an oversight but intended behavior, I thought I'd bring it to light.
The text was updated successfully, but these errors were encountered: