Files
Devour/devour_data/docs/reload.json
T
Tomas Dvorak 898a3c303f update
2026-02-24 10:33:59 +01:00

17 lines
2.7 KiB
JSON

{
"id": "f244654f589d265f7644ab96",
"source": "solid:signals",
"type": "github-document",
"title": "reload",
"content": "---\ntitle: reload\nuse_cases: \u003e-\n data refresh, cache invalidation, after mutations, updating queries, form\n submissions, data synchronization\ntags:\n - reload\n - cache\n - revalidation\n - mutations\n - queries\n - refresh\nversion: \"1.0\"\ndescription: \u003e-\n Reload and revalidate specific queries after mutations. Efficiently update\n cached data without full page refreshes for better UX.\n---\n\nThe `reload` function returns a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) object that instructs the router to revalidate specific queries when returned or thrown from a [query](/solid-router/reference/data-apis/query) or [action](/solid-router/concepts/actions).\n\n## Import\n\n```ts\nimport { reload } from \"@solidjs/router\";\n```\n\n## Type\n\n```ts\nfunction reload(init?: {\n\trevalidate?: string | string[];\n\theaders?: HeadersInit;\n\tstatus?: number;\n\tstatusText?: string;\n}): CustomResponse\u003cnever\u003e;\n```\n\n## Parameters\n\n### `init`\n\n- **Type:** `{ revalidate?: string | string[]; headers?: HeadersInit; status?: number; statusText?: string; }`\n- **Required:** No\n\nAn optional configuration object with the following properties:\n\n#### `revalidate`\n\n- **Type:** `string | string[]`\n- **Required:** No\n\nA query key or an array of query keys to revalidate.\n\n#### `headers`\n\n- **Type:** `HeadersInit`\n- **Required:** No\n\nAn object containing any headers to be sent with the response.\n\n#### `status`\n\n- **Type:** `number`\n- **Required:** No\n\nThe HTTP status code of the response.\nDefaults to [`200 OK`](http://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/200).\n\n#### `statusText`\n\n- **Type:** `string`\n- **Required:** No\n\nThe status text associated with the status code.\n\n## Examples\n\n### Basic Usage\n\n```ts\nimport { action, reload } from \"@solidjs/router\";\n\nconst savePreferencesAction = action(async () =\u003e {\n\t// ... Saves the user preferences.\n\n\t// Only revalidate the \"userPreferences\" query.\n\treturn reload({ revalidate: [\"userPreferences\"] });\n}, \"savePreferences\");\n```",
"url": "https://github.com/solidjs/solid-docs/blob/HEAD/src/routes/solid-router/reference/response-helpers/reload.mdx",
"metadata": {
"path": "src/routes/solid-router/reference/response-helpers/reload.mdx",
"repo": "solidjs/solid-docs",
"repo_url": "https://github.com/solidjs/solid-docs.git",
"size": 2001,
"source_type": "github"
},
"hash": "eff8479630e6c654e9e5b542b0b26a47b57b178667cd2f8d02943b994f821701",
"timestamp": "2026-02-23T11:43:00.193392148+01:00"
}