Skip to content

Commit

Permalink
fix: prefetching regression bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobrosenberg committed Jul 6, 2023
1 parent 3c85761 commit 5453641
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/runtime/Router/Router.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@
}
const handleHover = event => {
const eventUrl = getUrlFromEvent(event)
const url = router.clickHandler.callback?.(event, eventUrl) ?? eventUrl
let { url, state } = getUrlFromEvent(event)
const urlOrFalse = router.clickHandler.callback?.(event, url) ?? url
const shouldPrefetch =
typeof url === 'string' &&
typeof urlOrFalse === 'string' &&
event.target.closest('[data-routify-prefetch-data]')?.dataset
.routifyPrefetchData === 'hover'
if (shouldPrefetch) router.url.push(url, { prefetch: true })
if (shouldPrefetch) router.url.push(urlOrFalse, { prefetch: true, ...state })
}
const handleClick = event => {
Expand Down

0 comments on commit 5453641

Please sign in to comment.