github-repos-js — GitHub Repositories (continuation-URL pagination)

A demo of vanilla-grid against a public REST API that paginates via the HTTP Link header (rel="next" continuation URLs). Implements a custom DataManager that stores the next URL in its own state and ignores the grid's (skip, pageSize) hint entirely.

What it shows

Resizing the grid

The toolbar and the grid sit together in a src/vanilla-resize-box/ (aria-label="Resizable repositories grid and toolbar"). The box takes a single content child, so the two are stacked in a .resize-content wrapper, and it has a minimum size of 920 x 300 px (min-width="920", min-height="300"). Drag the corner handle to resize them together — resizing is pointer-driven, with no keyboard path. Double-click the handle to fill the available space, and again to restore the previous size.

The handle carries role="separator" and takes its accessible name from the host's aria-label — here "Resizable repositories grid and toolbar — resize handle" — but is not focusable, so it adds no tab stop to the page. This app's markup needs nothing beyond the aria-label it already carries.

Endpoint

GET https://api.github.com/search/repositories
    ?q=language:javascript
    &sort=stars
    &order=desc
    &per_page=100

per_page is capped at 100. The GitHub Search API silently clamps any larger value to 100. The data manager enforces this cap itself so the actual page size always matches what the server returns.

Sorting

Server-side sorting is wired for the three columns the GitHub Search API supports:

Grid column API sort= value
Stars stars
Forks forks
Updated updated

Clicking any other column header (Repo ID, Repository, Owner, Description, Language, Open Issues, Created, License, Topics) has no effect because GitHub does not expose a sort field for those. They are marked sortable="false" in the HTML so the sort indicator is never shown.

open_issues_count is intentionally non-sortable: the closest GitHub option (help-wanted-issues) counts only issues labelled "help wanted", which is not the same as total open issues and would produce confusing results.

Rate limits

GitHub allows 60 unauthenticated requests/hour per IP. To raise that to 5000/h, set a personal access token in DevTools console:

localStorage.setItem('github-repos-js:githubToken', 'ghp_yourReadOnlyToken');
location.reload();

The token requires no scopes for public-repo search.

A 429, or a 403 that carries X-RateLimit-Remaining: 0, is reported in the toolbar as the rate-limit message. GitHub also answers 403 for other reasons (a blocked or forbidden query), and those are reported as the plain HTTP error instead of being mistaken for a rate limit. The error reaches the status line once, from the DataManager's onFetchError hook.

The detail panel links the repository URL and its homepage only when they are http:/https: URLs (a homepage is free text its owner sets); any other scheme is shown as plain text.

Run

Serve the workspace root with any static server, then open /samples/github-repos-js/index.html.

Files

The same pattern works unchanged for any API that returns a Link header with rel="next" (Stripe, Atlassian, …). Only _buildInitialUrl() and _get() JSON shape need adapting.