Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-pushstate-warning-monkeypatch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: ignore third-party monkeypatches in `pushState`/`replaceState` warning detection
3 changes: 3 additions & 0 deletions packages/kit/src/runtime/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ if (DEV && BROWSER) {
if (!stack) return;
if (!stack[0].includes('https:') && !stack[0].includes('http:')) stack = stack.slice(1); // Chrome includes the error message in the stack
stack = stack.slice(2); // remove `warn` and the place where `warn` was called
// Filter out frames from third-party libraries that monkeypatch history methods (e.g. Sentry),
// since their presence in the stack doesn't mean the call originated from outside SvelteKit
stack = stack.filter((frame) => !frame.includes('node_modules'));
// Can be falsy if was called directly from an anonymous function
if (stack[0]?.includes(current_module_url)) return;

Expand Down
Loading