Home

hasPreviousPage

hasPreviousPage is a boolean flag used in pagination systems to indicate whether there is a page before the current one. It is commonly included in responses to help clients render navigation controls and to signal whether a "previous" action is possible. In GraphQL Relay, for example, the PageInfo object exposes hasPreviousPage (and hasNextPage) along with startCursor and endCursor, which mark the range of items in the current page.

In offset-based pagination, hasPreviousPage is typically determined by the current offset or page number. If the

In cursor-based pagination, hasPreviousPage indicates whether there are more items before the current page when using

Notes: hasPreviousPage is a convenience flag. Its accuracy depends on implementation details such as whether total

offset
is
greater
than
zero,
there
is
a
previous
page;
similarly,
if
using
page
numbers,
a
current
page
number
greater
than
one
implies
a
previous
page.
In
systems
with
a
known
total
item
count,
hasPreviousPage
can
be
derived
from
whether
the
current
slice
begins
after
the
first
item.
forward
or
backward
paging.
It
is
often
computed
from
the
presence
of
a
preceding
page,
or
from
the
ability
to
fetch
items
using
a
startCursor
with
a
backward
navigation
parameter.
counts
are
known
and
whether
the
dataset
can
change
between
requests.
It
is
typically
used
together
with
hasNextPage
and
the
cursor
values.