Skip to content

Commit

Permalink
fix(graphql): don鈥檛 allow the use of cursors with offset
Browse files Browse the repository at this point in the history
  • Loading branch information
calebmer committed Oct 15, 2016
1 parent e081040 commit 3159859
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/graphql/schema/connection/createConnectionGqlField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ export default function createConnectionGqlField <TSource, TInput, TItemValue>(
if (afterCursor && afterCursor.orderingName !== orderingName)
throw new Error('`after` cursor can not be used for this `orderBy` value.')

// Don鈥檛 allow the use of cursors with `offset`.
if (beforeCursor != null && _offset != null || beforeCursor != null && _offset != null)
throw new Error('Cannot use `before`/`after` cursors with `offset`!')

// Get our input.
const input = config.getPaginatorInput(source, args)

Expand Down

0 comments on commit 3159859

Please sign in to comment.