Skip to content

Commit

Permalink
Merge branch 'canary' into fix/rename-package-scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Feb 3, 2021
2 parents 7c3b0b2 + e750f43 commit fd60df7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/blog-starter/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ export function getAllPosts(fields = []) {
const posts = slugs
.map((slug) => getPostBySlug(slug, fields))
// sort posts by date in descending order
.sort((post1, post2) => (post1.date > post2.date ? '-1' : '1'))
.sort((post1, post2) => (post1.date > post2.date ? -1 : 1))
return posts
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@ import { useEffect } from 'react'
import { useRouter } from 'next/router'
import * as gtm from '../lib/gtm'

const handleRouteChange = () => {
gtm.pageview()
}

const GoogleTagManager = ({ children }) => {
const router = useRouter()

useEffect(() => {
router.events.on('routeChangeComplete', handleRouteChange)
router.events.on('routeChangeComplete', gtm.pageview)
return () => {
router.events.off('routeChangeComplete', handleRouteChange)
router.events.off('routeChangeComplete', gtm.pageview)
}
}, [router.events])

Expand Down

0 comments on commit fd60df7

Please sign in to comment.