Skip to content

Releases: CanopyTax/react-disposable-decorator

Adding ref support

19 Sep 16:36
Compare
Choose a tag to compare
  • Adding ref support by using react forward ref api
  • dropping support for react < 16.3

v3.2.0

03 May 15:50
Compare
Choose a tag to compare

Features

  • Support for rxjs@5+ observables, native browser observables, and other "cancelables" (such as throttled lodash functions) that implement cancel() (#9)

Fixes

  • Fix bug where calling cancelWhenUnmounted() after the component is already unmounted resulted in the subscription not being disposed. (#9)

Project improvements

  • Added tests (#9)
  • Upgraded to babel 7 (#9)

v3.0.0

01 Feb 18:14
Compare
Choose a tag to compare

Features

  • The decorator still decorates in test environments like normal. So cancelWhenUnmounted and cancelAllSubscriptions props are defined like normal (see #7)
  • You can disable the decorator in a test env by doing global.disableReactDisposableDecorator = true (see docs)

Breaking changes

  • The decorator still decorates in test environments like normal. This wasn't the case in 2.x
  • EnableReactDisposableDecorator was renamed (and inverted) to disableReactDisposableDecorator

Upgrading from 2.x to 3

When you upgrade from 2.x to 3, it's likely that a lot of tests will fail because your Enzyme wrappers will be referencing the decorator instead of the decorated component. To fix this, you have two options:

  1. Put global.disableReactDisposableDecorator = true into your jest.json's setupFiles code.
  2. add .dive() to all of your wrapper() calls on a component that uses react-disposable decorator. For example, change wrapper(<Foo />) to wrapper(<Foo />).dive()