Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/chore: only skip hydration with vite overlay if current page is an error #9892

Merged
merged 1 commit into from
May 10, 2023
Merged
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/shy-pears-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: only skip hydration with vite overlay if current page is an error
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export function create_client(app, target) {

/** @param {import('./types').NavigationFinished} result */
function initialize(result) {
if (DEV && document.querySelector('vite-error-overlay')) return;
if (DEV && result.state.error && document.querySelector('vite-error-overlay')) return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There can also be errors when you're not on the error page - so I don't fully understand how this reduces flakiness. Can you explain in more detail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There can also be errors when you're not on the error page

This function only runs after navigations or on the initial load and in those cases you would always be on the error page if there is an error (I think).

Since our tests are concurrent, the overlay is created even if the error was meant for another tab and skipping hydration prevents the rest of the test from running.

It's not the ideal solution, but currently Playwright doesn't offer a way to run specific tests without concurrency.

Right now there is one test where the overlay is expected but the overlay causes flakiness in other tests because it is unintentionally broadcasted to them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that makes sense!


current = result.state;

Expand Down