---
url: >-
  https://game-engine-io.github.io/enginex-frontend-sdk/reference/api/@getenginex/sdk/functions/nextUnseenCursor.md
---
[Reference](../../../index.md) / [@getenginex/sdk](../index.md) / nextUnseenCursor

# nextUnseenCursor()

> **nextUnseenCursor**(`nextCursor`, `usedCursors`): `string` | `undefined`

The cursor to ask for the next page of a cursor-paginated listing ([CursorPage](../interfaces/CursorPage.md)), or `undefined` when
there is none to follow: the last page (no `nextCursor`, or an empty one) or a cursor already used, which
means the gateway is going round in circles and asking again would read the same pages forever. Stop
offering "load more" when it returns `undefined`.

## Parameters

### nextCursor

`string` | `undefined`

The `nextCursor` of the page just read.

### usedCursors

`Iterable`<`string` | `undefined`>

The cursors already requested (the first page's `undefined` may be among them).

## Returns

`string` | `undefined`

## Example

```ts
// TanStack Query v5: `pageParams` holds every cursor already requested.
getNextPageParam: (last, _pages, _param, pageParams) => nextUnseenCursor(last.nextCursor, pageParams)
```

## Throws

Nothing.
