Skip to content

Releases: nytimes/react-tracking

v9.3.2

25 May 14:37
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v9.3.1...v9.3.2

v9.3.1

06 Jan 23:24
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v9.3.0...v9.3.1

v9.3.0 - `mergeOptions` added

18 Dec 04:57
Compare
Choose a tag to compare

New Features

You can now pass in mergeOptions as part of your config option to control exactly how react-tracking merges your tracking objects.

Example using isMergeableObject:

const { Track } = useTracking({}, { mergeOptions: { isMergeableObject: obj => !(obj instanceof Error) } });

Thanks @BenLorantfy for the implementation in #187 and @tizmagik for the documentation in #212

What's Changed

New Contributors

Full Changelog: v9.2.1...v9.3.0

v9.2.1 - React 18 peerDep

10 Aug 17:30
Compare
Choose a tag to compare

Added React 18 as an acceptable peerDep, thanks @AnthonyCrowcroft in #203

v9.2.0 - deepmerge re-export

01 Mar 16:57
Compare
Choose a tag to compare

Thanks to @tizmagik in #196 we now re-export deepmerge for convenience. (This is especially useful when you want to lazily attach additional tracking data on the dispatch call, for example).

import { deepmerge } from 'react-tracking';

v9.1.0 - New Debug Feature

07 Jan 18:40
Compare
Choose a tag to compare

Notable: New Debug Feature

πŸŽ‰ Thanks to @bgergen in #193 we now display a useful debug value when inspecting tracked components in the React Devtools

Screen Shot 2022-01-06 at 6 03 23 PM


What's Changed

  • Update drone yml to reference main by @bgergen in #184
  • Add options.process caveat to readme by @bgergen in #192
  • Take advantage of useDebugValue to display data in devtools by @bgergen in #193

Full Changelog: v9.0.0...v9.1.0

v9.0.0

23 Jul 21:06
Compare
Choose a tag to compare

No new features but this version drops core-js for a smaller build. Now polyfills are left up to userland which follows community best practices. See #167

Many thanks to @adi518 for kicking off this work πŸŽ‰ and the support from @antciccone @gedeagas and @bgergen πŸ™

v8.1.0 - Full React Hooks support

25 Nov 14:50
Compare
Choose a tag to compare

Thanks to @bgergen in #168 and #171 (testing support from @tizmagik in #165 and #170 ) react-tracking now fully supports React Hooks for all features (e.g. Hooks can be used completely instead of, or in addition to, the HoC/decorator API).

import { useTracking } from 'react-tracking';

const FooPage = () => {
  const { Track, trackEvent } = useTracking({ page: 'FooPage' });

  return (
    <Track>
      <div
        onClick={() => {
          trackEvent({ action: 'click' });
        }}
      />
    </Track>
  );
};

See the full docs in the main README starting here.

v8.0.0 - forwardRef support

12 Aug 18:51
Compare
Choose a tag to compare

Added forwardRef support in #153 thanks to @ParadeTo πŸŽ‰ . If you'd like to access the internal ref of a tracked component, just add the forwardRef option as part of the second param options object:

@track({}, { forwardRef: true })

Technically the API surface has not changed, we just added a new forwardRef: bool option. But React docs recommend bumping semver major when introducing such a change.

Example:

    const focusFn = () => {};

    @track({}, { forwardRef: true })
    class Child extends React.Component {
      focus = focusFn;

      render() {
        return 'child';
      }
    }

    class Parent extends React.Component {
      componentDidMount() {
        this.child.focus();
      }

      render() {
        return (
          <Child
            ref={el => {
              this.child = el;
            }}
          />
        );
      }
    }

v7.3.0

19 Dec 17:33
Compare
Choose a tag to compare

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.