nhagen/react-intercom

Don't sent request, when update copmonent props

Closed this issue · 2 comments

SVITY commented

It works fine 5-7 times, when props is updated. After that component does not send request to Intercom, when props is updated.

Any ideas? How to fix it?

I noticed the same issue. I just installed react-intercom and connected my user for Intercom to the user in my redux store:

<Intercom appID="kh0il1tk" {...this.props.user}/>

const mapStateToProps = (state) => ({ user: state.user })

And the problem in my case – and maybe in your's, too – were the many updates in rapid in succession (e.g. because the user moves a slider on a form, which continuously updates the user's attributes). Most of the time I didn't see the slider's actual position in Intercom, but rather see some value that the slider had in between.

My solution was to throttle the sending of events to Intercom. I simply didn't listen to the onChange event of my range slider (which sends continuous data in most browsers), but listened to the onTouchEnd and onMouseUp events. The latter two events only trigger once the user releases the range slider.

Do you have a similar case where you produce updates of the user's attributes in rapid succession?

Closing for now. If this is still a problem for anyone after #73 feel free to reply or create another issue.