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

Fix: page.resolve.then inline promise never resolving #2135

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/core/src/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ class CurrentPage {
replace = replace || isSameUrlWithoutHash(hrefToUrl(page.url), location)

return new Promise((resolve) => {
// resolve the promise in the callback, but if history.preserveUrl is true we need to resolve it immediately
// since the callback will never be called
replace ? history.replaceState(page, () => resolve(null)) : history.pushState(page, () => resolve(null))
if (history.preserveUrl) {
resolve(null)
}
}).then(() => {
const isNewComponent = !this.isTheSame(page)

Expand Down
Loading