github nytimes/react-tracking v7.3.0

latest releases: v9.3.2, v9.3.1, v9.3.0...
4 years ago

Fixed

2 closely related fixed having to do with decorating async methods:

Fixed by @rickh18 in #147 we now correctly return the underlying decorated method when decorating async functions (or functions that return promises).

Fixed by @tizmagik in #149 we now call trackEvent with an empty object {} instead of null so as not to throw TypeErrors in case userland is destructuring on the decorator, e.g. this method signature works fine now, even in the event of an error:

@track((props, state, methodArgs, [{ value }, err]) => {
  return {
    status: err || value,
  };
})
handleAsyncAction = async () => {
  return Math.random() > 0.5
    ? Promise.resolve({ value: 'some value' })
    : Promise.reject(new Error('some error'));
};

Minor changes

Fixed by @bgergen in #146 we now no longer export TrackingContextType since we switched to the new React Context API. This export was unlikely to be used in userland anyway so we kept this a semver minor instead of semver major.

Don't miss a new react-tracking release

NewReleases is sending notifications on new releases.