When there is a top-level process function defined and dispatchOnMount: true is passed in and the result of calling process() is to not dispatch, then the boolean for dispatchOnMount essentially has no effect.
Expected Behavior
When dispatchOnMount: true is passed in, it should always dispatch when the component mounts, unless the call to process() has dispatched, then it shouldn't (because we wouldn't want to dispatch the same data twice).
Actual Behavior
When dispatchOnMount: true is passed in, and there is a process() function defined (that happens to not dispatch), then that flag is essentially ignored.
The root cause of the issue is the conditional logic here:
Description
When there is a top-level
process
function defined anddispatchOnMount: true
is passed in and the result of callingprocess()
is to not dispatch, then the boolean fordispatchOnMount
essentially has no effect.Expected Behavior
When
dispatchOnMount: true
is passed in, it should always dispatch when the component mounts, unless the call toprocess()
has dispatched, then it shouldn't (because we wouldn't want to dispatch the same data twice).Actual Behavior
When
dispatchOnMount: true
is passed in, and there is aprocess()
function defined (that happens to not dispatch), then that flag is essentially ignored.The root cause of the issue is the conditional logic here:
https://github.com/NYTimes/react-tracking/blob/585da2754dd63475dfb61d69dcebf3da18ebbef3/src/withTrackingComponentDecorator.js#L68-L88
h/t @callihiggins