evidence icon indicating copy to clipboard operation
evidence copied to clipboard

More informative errors for HMR errors

Open hughess opened this issue 2 years ago • 10 comments

Description

Implements a new error overlay to replace the default Vite HMR error overlays.

Catalogs errors in hmrErrorHandling.js in component-utilities.

The idea here is to receive a Vite error message, evaluate the content it shares with us, then make an inference and supply the user with a more informative message.

This is a manual and inaccurate way to do this, but it's better than the messages our users currently receive from Vite.

To do

  • Tighten up some of the rules around “component was left open” - this is too eager a message at the moment
  • Confirm that this approach doesn’t slow down HMR for users
  • Check out what’s possible for logging - I don’t want to log the actual errors if we can avoid it…it’s a lot of text to the console and doesn’t contain much helpful info for a user (if any)
    • I’d like to log our custom errors to the console if we can

Example

CleanShot 2024-02-23 at 09 52 20

Checklist

  • [x] For UI or styling changes, I have added a screenshot or gif showing before & after
  • [x] I have added a changeset

hughess avatar Nov 20 '23 00:11 hughess

🦋 Changeset detected

Latest commit: dce0c98e1451ec9c0ec3625582ce5b4126dc330a

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

This PR includes changesets to release 5 packages
Name Type
@evidence-dev/component-utilities Minor
@evidence-dev/core-components Minor
@evidence-dev/components Minor
@evidence-dev/evidence Major
evidence-test-environment 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

changeset-bot[bot] avatar Nov 20 '23 00:11 changeset-bot[bot]

Deploy Preview for evidence-development-workspace ready!

Name Link
Latest commit dce0c98e1451ec9c0ec3625582ce5b4126dc330a
Latest deploy log https://app.netlify.com/sites/evidence-development-workspace/deploys/65e79048fb98ab000809843b
Deploy Preview https://deploy-preview-1346--evidence-development-workspace.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Nov 20 '23 00:11 netlify[bot]

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 5, 2024 9:36pm
evidence-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 5, 2024 9:36pm

vercel[bot] avatar Nov 20 '23 00:11 vercel[bot]

in the most recent commit, a new line is added to the svelte config. Initially I tried to add this to the config for the svelte vite plugin in vite.config as shown here (which feels like a better place for it), but that didn't work.

hughess avatar Nov 20 '23 16:11 hughess

When I tried to trace the path that a warning takes in the svelte vite plugin, I noticed that svelte-tiny-linked-charts seems to generate a lot of work/noise for the preprocessor. I don't know for sure, but I suspect this has an impact on performance of the initial page load since it's duplicating a bunch of the workflows

hughess avatar Nov 20 '23 16:11 hughess

We should deprecate this feature I think - we've talked about it before

archiewood avatar Nov 20 '23 16:11 archiewood

What's the story on this PR currently?

cc: @mcrascal @Winterhart

ItsMeBrianD avatar Feb 20 '24 22:02 ItsMeBrianD

@ItsMeBrianD I can take a look. It was paused during the USQL release, but I suspect it's good to go.

mcrascal avatar Feb 20 '24 22:02 mcrascal

@ItsMeBrianD It's not ready to go -- I'm getting URL.split is not a function when trying to boot it up.

mcrascal avatar Feb 21 '24 19:02 mcrascal

This one seems to be working on my end

hughess avatar Feb 22 '24 21:02 hughess