Skip to content

Commit

Permalink
Merge pull request #2163 from sjongejan/master
Browse files Browse the repository at this point in the history
Ensure callback execution
  • Loading branch information
joetannenbaum authored Jan 8, 2025
2 parents 3ac2fc8 + 7677aa0 commit af56fba
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/core/src/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ class History {
}

public pushState(page: Page, cb: (() => void) | null = null): void {
if (isServer || this.preserveUrl) {
if (isServer) {
return
}

if (this.preserveUrl) {
cb && cb();

return;
}

this.current = page

this.addToQueue(() => {
Expand Down Expand Up @@ -98,10 +104,16 @@ class History {
public replaceState(page: Page, cb: (() => void) | null = null): void {
currentPage.merge(page)

if (isServer || this.preserveUrl) {
if (isServer) {
return
}

if (this.preserveUrl) {
cb && cb();

return;
}

this.current = page

this.addToQueue(() => {
Expand Down

0 comments on commit af56fba

Please sign in to comment.