intercom-rails icon indicating copy to clipboard operation
intercom-rails copied to clipboard

Profiles with Intercom and Turbolinks 5

Open pedantic-git opened this issue 8 years ago • 14 comments

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

  1. Create an app with Turbolinks 5 installed, two pages and a link between them (using link_to)
  2. Install intercom-rails according to the instructions
  3. Click to go to the second page
  4. 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.

pedantic-git avatar May 04 '16 14:05 pedantic-git

Thanks for posting!

jimmybaker avatar May 10 '16 19:05 jimmybaker

We have the same issue. @pedantic-git thank you for posting the workaround, it works great!

mrhead avatar May 19 '16 14:05 mrhead

Any news on this issue?

GLiberman avatar Jun 02 '16 19:06 GLiberman

@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 avatar Jul 20 '16 09:07 choran

@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 avatar Jul 20 '16 09:07 pedantic-git

@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.

choran avatar Jul 20 '16 09:07 choran

Cheers - I will take a look later today and let you know!

pedantic-git avatar Jul 20 '16 09:07 pedantic-git

@choran @pedantic-git I just tested it on our site and it indeed works very well with Turbolinks 5. Thank you!

mrhead avatar Jul 20 '16 10:07 mrhead

@choran Just confirmed it works for me too!

pedantic-git avatar Jul 20 '16 10:07 pedantic-git

great, glad to hear.

choran avatar Jul 20 '16 11:07 choran

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

mrhead avatar Aug 01 '16 16:08 mrhead

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.

DJNgoma avatar Sep 05 '16 09:09 DJNgoma

Same here

dgilperez avatar Oct 14 '16 01:10 dgilperez

Is there any news on this?

ElliottRoche avatar May 11 '17 15:05 ElliottRoche