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

Reset prefetchCache when reloading a route. #617

Merged
merged 3 commits into from
Jan 2, 2017
Merged

Conversation

arunoda
Copy link
Contributor

@arunoda arunoda commented Jan 2, 2017

Fixes #616

If there's a HMR reload event, we'll prefetch again if the route is registered for prefetching.

@arunoda arunoda changed the title [WIP] Reset prefetchCache when reloading a route. Reset prefetchCache when reloading a route. Jan 2, 2017
@@ -77,6 +78,7 @@ export default class Router extends EventEmitter {

async reload (route) {
delete this.components[route]
await reloadIfPrefetched(route)
Copy link
Contributor

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.

Copy link
Contributor Author

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()
})
})
}
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah! That's true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@nkzawa nkzawa merged commit 01a1773 into vercel:master Jan 2, 2017
@arunoda arunoda deleted the fix-616 branch January 2, 2017 11:36
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants