Skip to content

Commit

Permalink
clean up logs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecAivazis committed Oct 19, 2023
1 parent 8ffb836 commit 2ef3e4a
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions packages/houdini-react/src/runtime/routing/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ function usePageData({

// if there is a pending request and we were asked to load, don't do anything
if (ssr_signals.has(id)) {
console.log('using ssr signal')
return ssr_signals.get(id)!
}

Expand Down Expand Up @@ -268,9 +269,6 @@ function usePageData({

// we're done
return resolvable

// this promise is also what we want to do with the main invocation
return ssr_signals.get(id)!
}

// the function that loads all of the data for a page using the caches
Expand Down Expand Up @@ -531,14 +529,12 @@ function useLinkNavigation({ goto }: { goto: (url: string) => void }) {

React.useEffect(() => {
const onClick: HTMLAnchorElement['onclick'] = (e) => {
console.log('target', e.target)
if (!e.target) {
return
}

const link = (e.target as HTMLElement | null | undefined)?.closest('a')
// its a link we want to handle so don't navigate like normal
console.log('link', link)

// we only want to capture a "normal click" ie something that indicates a route transition
// in the current tab
Expand All @@ -559,20 +555,16 @@ function useLinkNavigation({ goto }: { goto: (url: string) => void }) {
!e.defaultPrevented
)
) {
console.log('link', link)
return
}

// we need to figure out the target url by looking at the href attribute
const target = link.attributes.getNamedItem('href')?.value
console.log('target link', target)
// make sure its a link we recognize
if (!target || !target.startsWith('/')) {
return
}

console.log('processing link', target)

// its a link we want to handle so don't navigate like normal
e.preventDefault()
e.stopPropagation()
Expand All @@ -583,10 +575,8 @@ function useLinkNavigation({ goto }: { goto: (url: string) => void }) {
})
}

console.log('registering click handler')
window.addEventListener('click', onClick)
return () => {
console.log('unregistering click handler')
window.removeEventListener('click', onClick!)
}
}, [])
Expand Down

0 comments on commit 2ef3e4a

Please sign in to comment.