new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

React Router · API · all subjects

loaders & actions

7 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

shouldRevalidate method signature and behavior

The shouldRevalidate method is called during all revalidations and receives a defaultShouldRevalidate boolean parameter. This allows developers to opt out of any revalidation or to code their own logic and fallback on the default choice: function shouldRevalidate({ defaultShouldRevalidate }) { if (someEdgeCase()) { return false; } return defaultShouldRevalidate; }

Request.signal used instead of signal parameter

Loaders and actions receive a Request object that already contains its own signal property. There is no separate signal parameter passed to loaders and actions.

createStaticHandler for server data fetching

The server-side data-fetching migration uses createStaticHandler as the new API for handling data requests. The implementation involves creating a static handler per-request using unstable_createStaticHandler and using createHierarchicalRoutes to build React Router DataRouteObject instances.

handleResourceRequest with createStaticHandler

When implementing handleResourceRequest with createStaticHandler, it should be relatively simple since it only needs to send back the raw Response from queryRoute.

handleDataRequest with createStaticHandler

When implementing handleDataRequest with createStaticHandler, it needs to handle serializing errors and processing redirects into 204 Responses for the client.

shouldRevalidate replaces unstable_shouldReload

The unstable_shouldReload export is replaced by shouldRevalidate in React Router 6.4. The migration should prefer shouldRevalidate but can use unstable_shouldReload if present for backwards compatibility.

Request.signal parameter handling

In the Remix migration, Request.signal should continue to be sent as a separate signal parameter for backwards compatibility.

Give your agent this brain