Skip to content

Commit

Permalink
fixed method definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
joetannenbaum committed Oct 21, 2024
1 parent 33b1542 commit 5378ff9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/eventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class EventHandler {
url.hash = window.location.hash

history.replaceState({ ...currentPage.get(), url: url.href })
Scroll.reset(currentPage.get())
Scroll.reset()

return
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class CurrentPage {

return this.swap({ component, page, preserveState }).then(() => {
if (!preserveScroll) {
Scroll.reset(page)
Scroll.reset()
}

eventHandler.fireInternalEvent('loadDeferredProps')
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export class Router {

if (!currentPage.isCleared() && !visit.preserveUrl) {
// Save scroll regions for the current page
Scroll.save(currentPage.get())
Scroll.save()
}

const requestParams: PendingVisit & VisitCallbacks = {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/scroll.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { history } from './history'
import { Page, ScrollRegion } from './types'
import { ScrollRegion } from './types'

export class Scroll {
public static save(): void {
Expand All @@ -15,7 +15,7 @@ export class Scroll {
return document.querySelectorAll('[scroll-region]')
}

public static reset(page: Page): void {
public static reset(): void {
if (typeof window !== 'undefined') {
window.scrollTo(0, 0)
}
Expand Down

0 comments on commit 5378ff9

Please sign in to comment.