mongodb-js / connect-backbone-to-react

Connect Backbone Models and Collections to React.
https://www.npmjs.com/package/connect-backbone-to-react
Apache License 2.0
27 stars 5 forks source link

`models` cannot be received from props *and* context #14

Closed spencer-brown closed 6 years ago

spencer-brown commented 7 years ago

Based on the way context and props are handled here, models cannot be received from context and props simultaneously. props gets priority, knocking out any models passed via context. We had a discussion at @mixmaxhq about this today and concluded that it would probably make more sense for models received from context and props to be merged, eg with

const models = Object.assign({}, context.models, props.models);

~If we make this change, we'll also want to update how check received models here.~ <-- I don't think this is necessary, actually.


I wanted to check in with y'all before submitting a PR to hear how this lines up with your usage. Does this change make sense to y'all too? If so, I'm happy to go ahead and make it!

Thanks!

hswolff commented 7 years ago

Yep I dig that! Especially having props.models take priority over context as you showed in your example.

Super appreciate the thoughtful issue giving a heads up before hand as well.

Please do submit a PR!