Coder Social home page Coder Social logo

Comments (3)

nhagen avatar nhagen commented on August 15, 2024

I'm interested to know how you're considering using react-intercom. We handle this by using the component on two different branches of our application: /app and /marketing essentially. So when you go from marketing to the logged in version of the site, intercom shuts down and boots again, regardless of login status (populating it with user data in either case, if any).

This prompts me to wonder if there is any reason to recommend against that behavior. and whether that is compatible with public sites that have logins (or would that use case make this moot?).

Does that pattern work for you? This behavior could be added to the API, but I'm not sure that managing it explicitly is better than letting it happen automatically depending on your routes. Interested to know how this relates to your use case.

from react-intercom.

matanlb avatar matanlb commented on August 15, 2024

In our specific case we have 3 brunches and only contains Intercom.
Our pre login pages on that branch do not share a common higher order component, so we would have needed to either add it to several parent components, or create a logical parent for all non logged-in pages for this purpose alone.

We do have a root parent for that entire branch so it made sense for us to put it there, wrapping it in a component that supplies the required info and also preforms the shutdown/restart commands in case the logged in/out state changed.

Regarding if this is a better then the current behavior is an interesting question.
I assume the only differences are that the component could be added to higher order components and that the instead of deleting Intercom from window and re-running the snippet, a boot command could be passed in instead.

from react-intercom.

nhagen avatar nhagen commented on August 15, 2024

I assume the only differences are that the component could be added to higher order components

Can you elaborate on this? What I want to avoid is something like a designated prop like loggedIn, which feels weird when its value is false while user info is being passed--this kind of leans away from a single source of truth, which should be the intercom settings.

One solution I see is checking in componentWillRecieveProps whether the intercom user settings exist and are being removed, and if so, restart. Does that work for you? I'll need to go back and confirm with Intercom documentation that this makes sense though.

from react-intercom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.