Just launched my website at this link: I am experiencing a delay of up to 2 seconds between clicking the header links and the page loading. The site works fine in development and on localhost, so I'm not sure why there's such a slowdown on the live site.
UPDATE: The site performance deteriorates with each click until it eventually crashes. Could this be a memory leak issue?
I have identified the problematic code. How is it impacting every page load on my site?
const isBrowser = typeof window !== 'undefined'
if (isBrowser) {
this.setState({ isLoading: false })
}
//Monitor router events to display loading spinner
Router.events.on('routeChangeStart', () => {
this.setState({ isLoading: true })
})
Router.events.on('routeChangeComplete', () => {
this.setState({ isLoading: false })
})
Router.events.on('routeChangeError', () => {
this.setState({ isLoading: false })
})
Any suggestions for debugging? I've tried a few things with no luck.
Thank you