Skip to content

fix(library): fetch full library via paginated apps query - #541

Merged
zortos293 merged 2 commits into
devfrom
capy/fix-library-paginated-fetch
Jun 29, 2026
Merged

fix(library): fetch full library via paginated apps query#541
zortos293 merged 2 commits into
devfrom
capy/fix-library-paginated-fetch

Conversation

@zortos293

@zortos293 zortos293 commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

This PR adds cursor-based pagination to the library fetch to resolve the 40-game limit reported in #532.

  • Adds paginatedApps.ts with fetchAllAppsPages helper to traverse hasNextPage cursors.
  • Implements fetchPaginatedLibraryApps using the official apps query filtered by library.status != "NOT_OWNED".
  • Fetches 200 items per page for up to 25 pages to support full libraries.
  • Falls back to existing panel query if pagination fails.
  • Preserves isInLibrary and lastPlayed flags during metadata enrichment.

Open OPE-222 OPE-222


Note

Medium Risk
Changes core library loading and GraphQL behavior; fallback limits user impact, but very large libraries could still fail at the 25-page cap.

Overview
Fixes the ~40-game library cap by loading the user library through the GFN apps GraphQL query with cursor pagination instead of relying only on the LIBRARY panel.

A new fetchAllAppsPages helper walks hasNextPage / endCursor (200 items per page, up to 25 pages) and throws if the page limit is hit so results are not silently truncated. Library fetch filters to owned titles (library.status != NOT_OWNED) and uses the existing last-played sort order.

fetchLibraryGamesUncached tries this path first, then falls back to the panel query on failure. mergeAppMetaIntoGame now keeps library flags (isInLibrary, lastPlayed, per-variant library fields) when metadata enrichment overwrites app data.

Reviewed by Cursor Bugbot for commit 7acab46. Configure here.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@zortos293 zortos293 added the capy Generated by capy.ai label Jun 29, 2026 — with Image Capy AI
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1ba741db-c176-4f11-9dfc-10f516e5e774

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch capy/fix-library-paginated-fetch

Comment @coderabbitai help to get the list of available commands.

@cursor

cursor Bot commented Jun 29, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_7f300983-67dd-46ea-9856-f9c118f70182)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7acab460d3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

): Promise<GameInfo[]> {
const vpcId = await getVpcId(token, providerStreamingBaseUrl);
try {
const apps = await fetchPaginatedLibraryApps(token, vpcId);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bump the library cache key for paginated results

For users who already have a games:library cache written by the previous panel-based fetch, fetchLibraryGames returns that cached array before this new paginated path is ever reached, and the cache key/version is unchanged. Because loadFromCache returns cached data even when it is expired, the old 40-game library can continue to be shown after upgrade until a manual/forced refresh rewrites it; bump or invalidate the library cache when switching to the paginated result format.

Useful? React with 👍 / 👎.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@zortos293
zortos293 merged commit 75696aa into dev Jun 29, 2026
16 checks passed
Chizuui pushed a commit to Chizuui/OpenNOW-Modified that referenced this pull request Aug 11, 2026
…aming#541)

* Fetch entire owned library via paginated GraphQL query

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* Bump library cache for paginated fetch results

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capy Generated by capy.ai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant