From cf53192b77d619b1e43c8decda76d4083d9c17ea Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Wed, 15 Apr 2020 16:45:36 +0200 Subject: [PATCH] fix(scroll): only apply on browser --- src/utils/scroll.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/utils/scroll.ts b/src/utils/scroll.ts index 2a4da686..7e50c6b9 100644 --- a/src/utils/scroll.ts +++ b/src/utils/scroll.ts @@ -1,5 +1,7 @@ // import { RouteLocationNormalized } from '../types' +import { isBrowser } from './env' + export type ScrollToPosition = { x: number y: number @@ -73,9 +75,8 @@ export function scrollToPosition(position: ScrollPosition): void { export const scrollPositions = new Map() export function getScrollKey(path: string, distance: number): string { - const position: number = history.state - ? history.state.position - distance - : -1 + const position: number = + isBrowser && history.state ? history.state.position - distance : -1 return position + path } -- 2.39.5