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

Conversation

gtm-nayan
Copy link
Contributor

This shouldn't have any effect on users I think. But it gets rid of some flakiness in our tests.

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. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

@changeset-bot
Copy link

changeset-bot bot commented May 10, 2023

🦋 Changeset detected

Latest commit: 8f5eb76

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -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!

@dummdidumm dummdidumm merged commit bc70b4e into master May 10, 2023
@dummdidumm dummdidumm deleted the error-overlay-hydration branch May 10, 2023 08:44
@github-actions github-actions bot mentioned this pull request May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants