Skip to content

AutoBoot is not booting Intercom by the time trackEvent is called #747

@mt-pcuba

Description

@mt-pcuba

Intercom is not booted before the first 'trackEvent' being called, despite having autoBoot configured and enabled.
When my application loads it initializes Intercom, with the IntercomProvider component, and in one of the children it calls trackEvent. That even never sent to Intercom and I can see the following warning on the console:

[react-use-intercom] "trackEvent" was called but Intercom has not booted yet. Please call 'boot' before calling 'trackEvent' or set 'autoBoot' to true in the IntercomProvider.

This started happening with version 5.4.1. On version 5.4.0 it still worked as expected.

I thought this could be related to #635, but that seems to have been reported before version 5.4.1 was released.

I can see that the changes in 5.4.1 (a6d7757) affect the initialization, namely putting the initialization in an effect.
My component which calls trackEvent also does so inside useEffect, so it runs before Intercom was booted in the effect of IntercomProvider.
Is there a better way of tracking an event as soon as the components are "ready"? Or is this an unintended consequence of the change?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions