You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't figure out how the interrupt event should work inside the preload error handler in vite
function handlePreloadError(err: Error) {
const e = new Event('vite:preloadError', {
cancelable: true,
}) as VitePreloadErrorEvent
e.payload = err
window.dispatchEvent(e)
if (!e.defaultPrevented) {
throw err
}
}
We have dispatched event that we are going to prevent in our handler. But we have synchronious part of code with if condition, that (if I get it right) should be executed earlier
So how it should properly prevent our code to thrown an error if this event will be executed after synchronious code as macrotask?
I had this question cause I can't handle preload error without error was thrown in my app
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hey there
I can't figure out how the interrupt event should work inside the preload error handler in vite
We have dispatched event that we are going to prevent in our handler. But we have synchronious part of code with if condition, that (if I get it right) should be executed earlier
So how it should properly prevent our code to thrown an error if this event will be executed after synchronious code as macrotask?
I had this question cause I can't handle preload error without error was thrown in my app
Thank you for answers!
Beta Was this translation helpful? Give feedback.
All reactions