intercom-rails
intercom-rails copied to clipboard
Profiles with Intercom and Turbolinks 5
Version info
- intercom-rails version: 0.2.34
- Rails version: 4.2.6
- Turbolinks version: 5.0.0.beta2
Expected behavior
When pages are changed by Turbolinks, the Intercom widget should stay on the page.
Actual behavior
The widget disappears and does not reappear on the new page
Steps to reproduce
- Create an app with Turbolinks 5 installed, two pages and a link between them (using
link_to
) - Install intercom-rails according to the instructions
- Click to go to the second page
- The Intercom widget disappears
Workaround
I am currently working around this with an intercom.coffee file that looks like this:
$(document).on 'turbolinks:load', ->
window.Intercom("shutdown")
window.Intercom("boot", window.intercomSettings)
It's not ideal because it would be better for the Intercom not to shut down between page loads. The best way to do that would be to add the data-turbolinks-permanent
attribute to the outer div, so that Turbolinks knows not to remove it from the DOM when the page changes.
Thanks for posting!
We have the same issue. @pedantic-git thank you for posting the workaround, it works great!
Any news on this issue?
@pedantic-git ... thanks for raising this issue and the suggested workaround. This is not something we would include in the Rails plugin and should look at it in the Javascrip SDK. I see there is an issue opened for the javascript SDK and I believe this issue should now be resolved for Turbolinks 5.0. I will close the rails issue and feel free to follow up in the Intercom-js issue with any further issues in relation to this.
@choran That's so much for following up on this. I think the intercom-js repo is a private repo so I'm not able to follow that case. Could you please let this issue know when the it's fixed up there and a new version of the intercom-rails gem is released?
Thanks!!
@pedantic-git Sorry, forgot that! There was an issue with the turbo links version 5 which should now be resolved. It have been working with previous versions of turbolinks so that issues with 5 should now be resolved. As far as I am aware there should be no need to make any changes to the Intercom-Rails gem to pick this up. Let me know if you are still having issues and I can chase this up to ensure there is nothing we need to do on the rails side for this.
Cheers - I will take a look later today and let you know!
@choran @pedantic-git I just tested it on our site and it indeed works very well with Turbolinks 5. Thank you!
@choran Just confirmed it works for me too!
great, glad to hear.
Hey All,
I know that this isn't the best repo, but we do not have access to the intercom-js
repo so I am posting it here.
I noticed that the behaviour of intercom with Turbolinks 5 changed. Before the widget was persisted on page change initialized with Turbolinks. But now it is removed and created again after each page visit.
Is this a desired behaviour? Because I liked the previous one better.
Also can anyone else confirm it?
Thanks
Having the same issue as @mrhead. The sessions are opening and closing with Turbolinks when switching pages. I didn't experience the previous behaviour, but it would be nice for the new users who might be exploring my website.
Same here
Is there any news on this?