Skip to content

Commit

Permalink
fix(performance): fix onPageChange working error
Browse files Browse the repository at this point in the history
  • Loading branch information
Chryseis committed Dec 1, 2021
1 parent 5d4317a commit cc5a9ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions packages/web-performance/src/lib/getFirstVisitedState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { onPageChange } from './onPageChange'

let firstVisitedState = false

onPageChange(() => {
firstVisitedState = true
})

/**
* get state which page is visited
*/
const getFirstVisitedState = () => {
onPageChange(() => {
firstVisitedState = true
})

return {
get state() {
return firstVisitedState
Expand Down
4 changes: 2 additions & 2 deletions packages/web-performance/src/lib/onPageChange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { OnPageChangeCallback } from '../types'
import { proxyHistory } from './proxyHandler'

const unifiedHref = (href) => {
return href?.replace(`${location?.protocol}//${location?.host}`, '')
return decodeURIComponent(href?.replace(`${location?.protocol}//${location?.host}`, ''))
}

const lastHref = unifiedHref(location.href)
const lastHref = decodeURIComponent(unifiedHref(location.href))

/**
* when page is loaded, listen page change
Expand Down

0 comments on commit cc5a9ee

Please sign in to comment.