Repository: sveltejs/kit
Pull request #6794 (2022-09-14 09:06:52)

[docs] remove obsolete note
No longer true with new handleError

### Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
- [ ] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
- [ ] This message body should clearly illustrate what problems it solves.
- [ ] Ideally, include a test that fails without this PR but passes with it.

### Tests
- [ ] Run the tests with `pnpm test` and lint the project with `pnpm lint` and `pnpm check`

### Changesets
- [ ] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running `pnpm changeset` and following the prompts. All changesets should be `patch` until SvelteKit 1.0


changeset-bot[bot]: ###  ⚠️  No Changeset found

Latest commit: a061400baa4bdc48febcd7201d4798ab2afeb47c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. **If these changes should result in a version bump, you need to add a changeset.**

<details><summary>This PR includes no changesets</summary>

  When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

</details>

[Click here to learn what changesets are, and how to add one](https://github.com/changesets/changesets/blob/master/docs/adding-a-changeset.md).

[Click here if you're a maintainer who wants to add a changeset to this PR](https://github.com/sveltejs/kit/new/dummdidumm-patch-1?filename=.changeset/orange-impalas-juggle.md&value=---%0A%0A---%0A%0A%5Bdocs%5D%20remove%20obsolete%20note%0A)


Conduitry: Hmmm. Should we instead change the default `handleError` behavior so that we can have this behavior? It sounds like it would be expected and useful. Is that practical?
dummdidumm: Sounds somewhat related to #6793 where it was requested to change the behavior this in a slightly different way, too.

Patch:
diff --git a/.changeset/funny-cycles-travel.md b/.changeset/funny-cycles-travel.md
new file mode 100644
index 000000000..80f8a991c
--- /dev/null
+++ b/.changeset/funny-cycles-travel.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+[fix] update current.url on hashchange
diff --git a/.changeset/gorgeous-flowers-doubt.md b/.changeset/gorgeous-flowers-doubt.md
new file mode 100644
index 000000000..2bc67bc5d
--- /dev/null
+++ b/.changeset/gorgeous-flowers-doubt.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+[fix] silence prop warnings
diff --git a/.changeset/immaculate-error-handler.md b/.changeset/immaculate-error-handler.md
new file mode 100644
index 000000000..bc16312ba
--- /dev/null
+++ b/.changeset/immaculate-error-handler.md
@@ -0,0 +1,6 @@
+---
+'@sveltejs/adapter-vercel': patch
+---
+
+Ignore warnings when traced file fails to parse
+
diff --git a/documentation/docs/05-load.md b/documentation/docs/05-load.md
index d048a2f7a..08ae6cc9b 100644
--- a/documentation/docs/05-load.md
+++ b/documentation/docs/05-load.md
@@ -310,8 +310,6 @@ export function load({ locals }) {
 
 If an _unexpected_ error is thrown, SvelteKit will invoke [`handleError`](/docs/hooks#shared-hooks-handleerror) and treat it as a 500 Internal Error.
 
-> In development, stack traces for unexpected errors are visible as `$page.error.stack`. In production, stack traces are hidden.
-
 ### Redirects
 
 To redirect users, use the `redirect` helper from `@sveltejs/kit` to specify the location to which they should be redirected alongside a `3xx` status code.
diff --git a/packages/adapter-vercel/index.js b/packages/adapter-vercel/index.js
index 37027c836..071d025e7 100644
--- a/packages/adapter-vercel/index.js
+++ b/packages/adapter-vercel/index.js
@@ -308,6 +308,11 @@ async function create_function_bundle(builder, entry, dir, runtime) {
 		// pending https://github.com/vercel/nft/issues/284
 		if (error.message.startsWith('Failed to resolve dependency node:')) return;
 
+		// parse errors are likely not js and can safely be ignored,
+		// such as this html file in "main" meant for nw instead of node:
+		// https://github.com/vercel/nft/issues/311
+		if (error.message.startsWith('Failed to parse')) return;
+
 		if (error.message.startsWith('Failed to resolve dependency')) {
 			const match = /Cannot find module '(.+?)' loaded from (.+)/;
 			const [, module, importer] = match.exec(error.message);
diff --git a/packages/kit/src/runtime/client/client.js b/packages/kit/src/runtime/client/client.js
index 09be6d707..c6447c09a 100644
--- a/packages/kit/src/runtime/client/client.js
+++ b/packages/kit/src/runtime/client/client.js
@@ -43,6 +43,7 @@ function update_scroll_positions(index) {
 	scroll_positions[index] = scroll_state();
 }
 
+// TODO remove for 1.0
 /** @type {Record<string, true>} */
 let warned_about_attributes = {};
 
@@ -1321,10 +1322,12 @@ export function create_client({ target, base, trailing_slash }) {
 				if (hash !== undefined && base === location.href.split('#')[0]) {
 					// set this flag to distinguish between navigations triggered by
 					// clicking a hash link and those triggered by popstate
+					// TODO why not update history here directly?
 					hash_navigating = true;
 
 					update_scroll_positions(current_history_index);
 
+					current.url = url;
 					stores.page.set({ ...page, url });
 					stores.page.notify();
 
@@ -1545,25 +1548,26 @@ function add_url_properties(type, target) {
 
 function pre_update() {
 	if (__SVELTEKIT_DEV__) {
-		// Nasty hack to silence harmless warnings the user can do nothing about
-		const warn = console.warn;
-		console.warn = (...args) => {
-			if (
-				args.length === 1 &&
-				/<(Layout|Page)(_[\w$]+)?> was created (with unknown|without expected) prop '(data|form)'/.test(
-					args[0]
-				)
-			) {
-				return;
-			}
-			warn(...args);
-		};
-
 		return () => {
-			tick().then(() => (console.warn = warn));
 			check_for_removed_attributes();
 		};
 	}
 
 	return () => {};
 }
+
+if (__SVELTEKIT_DEV__) {
+	// Nasty hack to silence harmless warnings the user can do nothing about
+	const warn = console.warn;
+	console.warn = (...args) => {
+		if (
+			args.length === 1 &&
+			/<(Layout|Page)(_[\w$]+)?> was created (with unknown|without expected) prop '(data|form)'/.test(
+				args[0]
+			)
+		) {
+			return;
+		}
+		warn(...args);
+	};
+}


Test patch:
diff --git a/packages/kit/test/apps/basics/src/routes/routing/hashes/pagestore/+page.svelte b/packages/kit/test/apps/basics/src/routes/routing/hashes/pagestore/+page.svelte
index 4a20ec56a..630589a9d 100644
--- a/packages/kit/test/apps/basics/src/routes/routing/hashes/pagestore/+page.svelte
+++ b/packages/kit/test/apps/basics/src/routes/routing/hashes/pagestore/+page.svelte
@@ -17,5 +17,6 @@
 <h1 id="window-hash">{hash}</h1>
 <h1 id="page-url-hash">{$page.url.hash}</h1>
 
-<a href="#target">Nav to #ing with anchor tag</a>
+<a href="#target">Nav to hash</a>
+<a href="/routing/hashes/pagestore">Nav to page</a>
 <div id="target">Target</div>
diff --git a/packages/kit/test/apps/basics/test/client.test.js b/packages/kit/test/apps/basics/test/client.test.js
index 1c1237820..d581e34ed 100644
--- a/packages/kit/test/apps/basics/test/client.test.js
+++ b/packages/kit/test/apps/basics/test/client.test.js
@@ -551,6 +551,9 @@ test.describe('Routing', () => {
 		await page.click('[href="#target"]');
 		expect(await page.textContent('#window-hash')).toBe('#target');
 		expect(await page.textContent('#page-url-hash')).toBe('#target');
+		await page.click('[href="/routing/hashes/pagestore"]');
+		await expect(page.locator('#window-hash')).toHaveText('#target'); // hashchange doesn't fire for these
+		await expect(page.locator('#page-url-hash')).toHaveText('');
 	});
 
 	test('does not normalize external path', async ({ page }) => {