{"record":{"id":"8a2c84c87af47fdd","repo":"sveltejs/kit","slug":"the-goto-replacestate-opts-replacestate","errorCode":null,"errorMessage":"The `goto(..., { replaceState: ${opts.replaceState} })` option has been deprecated in favour of `replace`","messagePattern":"The `goto\\(\\.\\.\\., (.+?)\\)` option has been deprecated in favour of `replace`","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/kit/src/runtime/client/client.js","lineNumber":2680,"sourceCode":"\n/**\n * Allows you to navigate programmatically to a given route, with control over details such as whether scroll and focus are reset\n * (as they would be with a regular navigation) or preserved.\n *\n * Returns a Promise that resolves when SvelteKit navigates (or fails to navigate, in which case the promise rejects) or the state change has been applied.\n *\n * `goto` is intended for navigations to routes that belong to the app, and will reject if a route cannot be resolved.\n * For external URLs, use `window.location = url` to perform a full-page navigation instead of calling `goto(url)`.\n *\n * @param {string | URL} url Where to navigate to. Note that if you've set [`config.paths.base`](https://svelte.dev/docs/kit/configuration#paths) and the URL is root-relative, you need to prepend the base path if you want to navigate within the app.\n * @param {GotoOptions} [opts] Options related to the navigation\n * @returns {Promise<void>}\n */\nexport async function goto(url, opts = {}) {\n\tif (DEV) {\n\t\tif ('replaceState' in opts && !warned_on_replace_state) {\n\t\t\twarned_on_replace_state = true;\n\t\t\tconsole.warn(\n\t\t\t\t`The \\`goto(..., { replaceState: ${opts.replaceState} })\\` option has been deprecated in favour of \\`replace\\``\n\t\t\t);\n\t\t}\n\n\t\tif ('noScroll' in opts || 'keepFocus' in opts) {\n\t\t\tthrow new Error(\n\t\t\t\t`The \\`goto(..., { noScroll: true, keepFocus: true })\\` options have been replaced by \\`reset: false\\``\n\t\t\t);\n\t\t}\n\t}\n\n\tconst replace = opts.replace ?? opts.replaceState ?? false;\n\n\tconst intent = await resolve_intent(url, 'goto');\n\n\tif (opts.shallow) {\n\t\treturn update_state(\n\t\t\tintent,","sourceCodeStart":2662,"sourceCodeEnd":2698,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/client/client.js#L2662-L2698","documentation":"The `replaceState` option of `goto()` was renamed: use `replace: true` to replace the current history entry (the default also changed semantics across versions). DEV warns once when `replaceState` appears in the options object; it will be removed in a future major.","triggerScenarios":"Calling `goto(url, { replaceState: true })` or `replaceState: false` from client code; the `goto` export in packages/kit/src/runtime/client/client.js warns when `'replaceState' in opts`.","commonSituations":"Redirect-after-login or filter updates that should not create a history entry, written against older SvelteKit 2 pre-release APIs.","solutions":["Replace `{ replaceState: true }` with `{ replace: true }`","If you intended push navigation, remove the option entirely (push is the default)","Grep for `replaceState:` in goto call sites and update them"],"exampleFix":"// before\ngoto('/dashboard', { replaceState: true });\n// after\ngoto('/dashboard', { replace: true });","handlingStrategy":"validation","validationCode":"const opts = { replaceState: true };\nif ('replaceState' in opts) { opts.replace = opts.replaceState; delete opts.replaceState; }\ngoto(url, opts);","typeGuard":"function usesReplaceState(o) { return o != null && 'replaceState' in o; }","tryCatchPattern":null,"preventionTips":["Use `replace: true` for history-replacing navigation","Grep for `replaceState:` in goto calls during upgrades"],"tags":["deprecation","navigation","client-side"],"backgroundTag":"deprecated-option","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}