{"record":{"id":"8d74793b4586d976","repo":"sveltejs/kit","slug":"the-goto-noscroll-true-keepfocus-true","errorCode":null,"errorMessage":"The `goto(..., { noScroll: true, keepFocus: true })` options have been replaced by `reset: false`","messagePattern":"The `goto\\(\\.\\.\\., (.+?)\\)` options have been replaced by `reset: false`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/kit/src/runtime/client/client.js","lineNumber":2686,"sourceCode":" *\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,\n\t\t\topts.state ?? {},\n\t\t\t{\n\t\t\t\treplace,\n\t\t\t\tpersist_state: opts.persistState ?? false,\n\t\t\t\treset: opts.reset ?? false\n\t\t\t},","sourceCodeStart":2668,"sourceCodeEnd":2704,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/client/client.js#L2668-L2704","documentation":"The legacy goto options noScroll and keepFocus were replaced by the single `reset: false` option. SvelteKit throws immediately when it sees either removed key so behavior is explicit rather than silently changing. Note `replaceState` is only deprecated (warned), while noScroll/keepFocus hard-fail.","triggerScenarios":"Calling goto(url, { noScroll: true }) or goto(url, { keepFocus: true }) — any presence of these keys in the options object throws, regardless of value.","commonSituations":"Upgrading SvelteKit from a version before the goto options rework; copying old tutorial/snippet code; migrating libraries that wrapped goto with legacy options.","solutions":["Replace { noScroll: true, keepFocus: true } with { reset: false }","Remove noScroll/keepFocus keys and rely on default reset behavior","Also migrate deprecated replaceState to the `replace` option"],"exampleFix":"// before\nawait goto('/dashboard', { noScroll: true, keepFocus: true });\n// after\nawait goto('/dashboard', { reset: false });","handlingStrategy":"validation","validationCode":"function assertGotoOptions(opts) {\n  if ('noScroll' in opts || 'keepFocus' in opts) {\n    throw new Error('Use { reset: false } instead of noScroll/keepFocus');\n  }\n}\nassertGotoOptions({ reset: false });","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Codemod goto option objects when upgrading SvelteKit","Wrap goto in a project helper exposing only current options","Check the changelog before migrating navigation code"],"tags":["navigation","deprecated-api","sveltekit"],"backgroundTag":"deprecated-api-option","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}