Releases: CanopyTax/react-disposable-decorator
Releases · CanopyTax/react-disposable-decorator
Release list
Adding ref support
- Adding ref support by using react forward ref api
- dropping support for react < 16.3
v3.2.0
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
v3.0.0
Features
- The decorator still decorates in test environments like normal. So
cancelWhenUnmountedandcancelAllSubscriptionsprops 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
EnableReactDisposableDecoratorwas renamed (and inverted) todisableReactDisposableDecorator
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:
- Put
global.disableReactDisposableDecorator = trueinto your jest.json'ssetupFilescode. - add
.dive()to all of yourwrapper()calls on a component that uses react-disposable decorator. For example, changewrapper(<Foo />)towrapper(<Foo />).dive()