feat: emit event to handle chunk load errors#12084
Merged
patak-cat merged 4 commits intovitejs:mainfrom Jun 15, 2023
Merged
Conversation
15 tasks
patak-cat
previously approved these changes
May 24, 2023
Member
patak-cat
left a comment
There was a problem hiding this comment.
It seems we missed this one. I'll add it for discussion in the next team meeting so we can include it in Vite 4.4
Contributor
|
When is the next team meeting? |
Member
|
@KaelWD in two days. We'll see to resolve the PR async if we don't manage to get to this PR in the meeting. I'll add it to the 4.4 milestone. |
patak-cat
approved these changes
Jun 15, 2023
4 tasks
8 tasks
This was referenced Dec 1, 2023
patak-cat
reviewed
May 6, 2024
Comment on lines
+142
to
+144
| if (!e.defaultPrevented) { | ||
| throw err | ||
| } |
Member
There was a problem hiding this comment.
You need to call preventDefault() on the event. Please avoid commenting on old PRs. You can create a Discussion instead for these questions (linking to a PR if you'd like)
4 tasks
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
resolves #12080
This PR emits a
vite:preloadErrorevent which can be handled by a framework or user. Primarily this will be useful for saving state and reloading an app in the event of a fresh deployment.Additional context
If
preventDefault()is called on this event, the error will not be thrown. I confess I'm not entirely sure whether this is a good idea, but it provides an escape hatch that may be useful.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123).