Response Helpers

reload

Edit this page

Reload is a response helper built on top of revalidate. It will receive a cache key, or an array of cache keys, to invalidate those queries, and cause them to fire again.

"/actions/update-todo.ts"{4}
import { action, reload } from "@solidjs/router";
import { putTodo, getTodo } from "../db";
const updateTodo = action(async (todo: Todo) => {
await putTodo(todo.id, todo);
return reload({ revalidate: getTodo.keyFor(id) });
});

The code snippet above uses the cache-key from a user-defined query (getTodo). To better understand how queries work, check the query documentation.


TypeScript Signature

interface ResponseOptions & Omit<ResponseInit, "body"> {
revalidate?: string | string[];
}
reload(opt?: ResponseOptions): CustomResponse<never>;

The ResponseOptions extens the types from the native ResponseInit interface.

Report an issue with this page