rxreact / core

Typescript based RX bindings for React
MIT License
41 stars 5 forks source link

feat(withViewModelFactory): add an unsubscribe option #73

Open will-wow opened 4 years ago

will-wow commented 4 years ago

Goals

Allow users of a viewModelFactory to create subscriptions in the function, and unsub when the component unmounts. This should prevent memory leaks when a user creates a subscription in a viewModelFactory.

Implementation

For discussion

Unrelated, but when getting the project going, I had to go back to Node 6 (which to be fair is what's listed in the package.json) to prevent some node-gyp error.

I'm also getting a typescript error from WrappedComponent even on master:

Type 'Readonly<S> & ActionMap<A> & Readonly<{ children?: ReactNode; }> & Readonly<Pick<T, Exclude<keyof T, keyof S | keyof A>> & P>' is not assignable to type 'IntrinsicAttributes & T & { children?: ReactNode; }'.
  Type 'Readonly<S> & ActionMap<A> & Readonly<{ children?: ReactNode; }> & Readonly<Pick<T, Exclude<keyof T, keyof S | keyof A>> & P>' is not assignable to type 'T'.
    'Readonly<S> & ActionMap<A> & Readonly<{ children?: ReactNode; }> & Readonly<Pick<T, Exclude<keyof T, keyof S | keyof A>> & P>' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'ActionMap<A>'
coveralls commented 4 years ago

Pull Request Test Coverage Report for Build 748


Totals Coverage Status
Change from base Build 36: 0.0%
Covered Lines: 65
Relevant Lines: 65

💛 - Coveralls