Skip to content

Instantly share code, notes, and snippets.

@jittarao
Last active August 9, 2022 08:18
Show Gist options
  • Save jittarao/09e834d2e8f77046643d3785604cb3ec to your computer and use it in GitHub Desktop.
Save jittarao/09e834d2e8f77046643d3785604cb3ec to your computer and use it in GitHub Desktop.
@sadiqmmm
Copy link

Hi, After implementing this on a Rails 6 application, full page refresh works fine. But visiting the pages by clicking the links. I am getting "Uncaught ReferenceError: gist is not defined"

@jittarao
Copy link
Author

@sadiqmmm Can you share which line in the code this error is coming from?

@sadiqmmm
Copy link

Not sure about the line as it is minified. I am seeing this in chrome console.
Screenshot 2020-05-11 at 3 13 24 AM
Screenshot 2020-05-11 at 3 14 50 AM

@jittarao
Copy link
Author

@sadiqmmm I will test this and come back shortly. Meanwhile, see if commenting line number 8 helps resolve this.

@sadiqmmm
Copy link

@jittarao Thanks for the update. I have commented the line 8 "document.addEventListener(unloadEvent, unloadHandler);" Error is gone. But the widget is not loading up. Only full page refresh is working correctly. Not with the Turbolinks.

@jittarao
Copy link
Author

jittarao commented May 11, 2020

@sadiqmmm just to confirm, have you put the original code in the head tag or body tag? Ideally, it should go into the body tag.

@sadiqmmm
Copy link

sadiqmmm commented May 11, 2020

@jittarao Working after moving the code from head tag to body tag. Thanks

@lefermierperso
Copy link

@jittarao on rails 6 using turbo instead of turbolink, it could be nice to have the possibility to add in body an empty "#gist-app" div in data-turbo-permanent in order to keep the frame loaded throw navigation. Or defining a div parent ?

The main problem i have is that events on document are stacking on each load...
events come from :
_cfCommonFunctions.prototype.gtAddMultipleListenerToDoc(document, ["touchstart", "touchmove", "touchend", "mouseover", "mousemove", "mousedown", "mouseup", "click", "keydown", "keypress", "keyup", "submit", "change", "scroll", "resize", "dblclick"], _cfCommonFunctions.prototype.gtHandlerOfListener, !1),

see in the profiller after 5-6 pages
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment