Starts the first request of the page a visit lands on before that page's code has loaded, so that the two travel together rather than one after the other. main.tsx starts it as the app boots (startLandingRequest), and useAuth's authFetch hands its response to the page that asks for the same URL (takeEarly), in place of a request of its own.

Functions

f
clearEarlyRequests(): void

Forgets the requests started, between the tests' cases.

f
landingRequest(pathname: string): string | null

Returns the URL the page at pathname loads first, as that page builds it, or null for a page that isn't started early: the feed of every dump, on any of its tabs, asks for its first page, and a dump's page for the dump. The other pages wait for their code, as before.

f
startLandingRequest(pathname: string): void

Sends the request landingRequest names for pathname, with the stored session's token as authFetch would, and keeps its response for takeEarly. It never throws: a request that fails does so in the hands of the page that takes it, as its own would.

f
takeEarly(
url: string,
token: string | undefined
): Promise<Response> | undefined

Returns the response of the request started for url, once and to the session it was sent as, or undefined when there is none, or none recent enough: the caller then sends its own. authFetch asks it for every GET.