Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed May 16, 2022
1 parent 563f4ea commit c546c41
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/docusaurus-plugin-google-gtag/src/gtag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ const clientModule: ClientModule = {
onRouteDidUpdate({location, previousLocation}) {
if (previousLocation && location.pathname !== previousLocation.pathname) {
// Normally, the document title is updated in the next tick due to how
// `react-helmet-async` updates it.
// We want to send to gtag the current document title so we use
// setTimeout to put the function on the callback stack to be executed
// on the next tick.
// `react-helmet-async` updates it. We want to send the current document's
// title to gtag instead of the old one's, so we use `setTimeout` to defer
// execution to the next tick.
// See: https://github.com/facebook/docusaurus/issues/7420
setTimeout(() => {
// Always refer to the variable on window in case it gets overridden
Expand Down

0 comments on commit c546c41

Please sign in to comment.