Closed doulighan closed 3 months ago
Edit: It appears this was already discussed and declined here https://github.com/devrnt/react-use-intercom/issues/149#issuecomment-738207869, I'll close this one.
And additionally, I've learned now that boot
can be called multiple times, which fixes my specific issue. See https://github.com/devrnt/react-use-intercom/issues/555
Is your feature request related to a problem? Please describe.
Maybe there's already a better way to do this that I'm missing. Suggestions welcome!
A possible flow might look like: 1) Unauthenticated user loads the page.
autoBoot
begins Intercom in "Visitor" mode, to cover the login page or cover the user if session auth fails. 2) The user authenticates, and we callupdate()
to put Intercom into "User" mode. 3) The user signs out. We callshutdown()
to clear storage. 4) The user signs back in without refreshing the page. Now, our typical call toupdate()
will fail.Describe the solution you'd like
An
isBooted
value would make it easy to conditionally callboot()
orupdate()
.Describe alternatives you've considered
a) Manually reboot intercom in "Visitor" mode immediately after calling
shudown
, before the redirect to /login.b) Track isBooted ourselves in a global variable
react-use-intercom
I'm not sure this is possible.c) Don't use
autoBoot
, manage Visitors and Users separately