From 02bd767d3277a840b480fe94444cd1c886ef519b Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 3 Feb 2023 05:43:00 -0500 Subject: [PATCH] docs: tell people to avoid `goto(external)` related to #8775 --- .changeset/loud-pans-fly.md | 5 +++++ packages/kit/types/ambient.d.ts | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changeset/loud-pans-fly.md diff --git a/.changeset/loud-pans-fly.md b/.changeset/loud-pans-fly.md new file mode 100644 index 000000000000..1e595deb3353 --- /dev/null +++ b/.changeset/loud-pans-fly.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +docs: discourage use of `goto` with external URLs diff --git a/packages/kit/types/ambient.d.ts b/packages/kit/types/ambient.d.ts index 79801c8a3928..606475b4c380 100644 --- a/packages/kit/types/ambient.d.ts +++ b/packages/kit/types/ambient.d.ts @@ -170,6 +170,7 @@ declare module '$app/navigation' { export function disableScrollHandling(): void; /** * Returns a Promise that resolves when SvelteKit navigates (or fails to navigate, in which case the promise rejects) to the specified `url`. + * For external URLs, use `window.location = url` instead of calling `goto(url)`. * * @param url Where to navigate to. Note that if you've set [`config.kit.paths.base`](https://kit.svelte.dev/docs/configuration#paths) and the URL is root-relative, you need to prepend the base path if you want to navigate within the app. * @param opts Options related to the navigation