reload
Edit this pageReload 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.
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.