-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Reset prefetchCache when reloading a route. #617
Conversation
@@ -77,6 +78,7 @@ export default class Router extends EventEmitter { | |||
|
|||
async reload (route) { | |||
delete this.components[route] | |||
await reloadIfPrefetched(route) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reload
is called only on special cases (errors, add/remove pages). I wonder if we don't have to fix another cases (webpack's normal HMRs) too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to do anything for normal HMR since the page gets updated via HMR.
We need to do this, because we are removing the page from the cache and loading a error page instead.
return resolve() | ||
}) | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should have only the promise version of the method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah! That's true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Fixes #616
If there's a HMR reload event, we'll prefetch again if the route is registered for prefetching.