Search code examples
angularjshttp-redirectangular-ui-routerintercom

Redirect a state to an abstract state's child with UI-Router in AngularJS throws Intercom error


I am re-structuring a state into an abstract state with a child that contains many nested views.

I need to preserve the oldState, and my goal is to have any reference to oldState redirect to 'app.newState.home'.

The current implementation I am using below (using redirectTo, Redirect a state to default substate with UI-Router in AngularJS) works in terms of redirecting to the child state of a different abstract state. HOWEVER - I get this error from Segment analytics:

https://api-iam.intercom.io/ping/events 422 (Unprocessable Entity) [{"code":"422","message":"Cannot have more than 120 active event names"}]}

.state('app.oldState', {
  url: '/oldState',
  redirectTo: 'app.newState.home',
})

.state('app.newState', {
    url: '/oldState',
    // abstract: true,
    templateUrl: helper.basepath('anotherTemplate'),
    resolve: helper.resolveFor('datatables','easypiechart','ngDialog','angularFileUpload', 'filestyle', 'taginput'),
})


.state('app.newState.home', {
  url: '',
  views: {
    'firstView':{
      templateUrl: helper.basepath('templateOne'),
      controller: 'ControllerOne'
    },
    'secondView':{
      templateUrl: helper.basepath('templateTwo'),
      controller: 'ControllerOne'
    },
    'thirdView':{
      templateUrl: helper.basepath('templateThree'),
      controller: 'ControllerOne'
    },
    'fourthView':{
      templateUrl: helper.basepath('templateFour'),
      controller: 'ControllerTwo'
    },
  }
})

Why is this error being thrown and how can I properly resolve this issue???


Solution

  • Intercom permits max 120 event names. This is documented here https://docs.intercom.com/the-intercom-platform/track-events-in-intercom under the header "Is there a limit on the number of event types I can send?".

    The documentation also explains how to "archive" events, which presumably resolves this situation until one hits the limit again.