-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using of fetch is ignored #54
Comments
I'm pretty sure the problem is because you're setting the collection inside |
In this case the component is being passed to another processor so I can't use factory pattern and initialise compiled component. For me it is obviously bug as it shouldn't be any difference when setting models/collections on the compiled component or within component body, should it? EDIT: The component is passed directly to the router ( |
Keep in mind that getDefaultProps gets cached. I need to investigate further to see if there's no problem on fallbacking models/collections to the ones returned by getDefaultProps. On Terça-feira, 27/01/2015 at 01:44, Karol Janyst notifications@github.com, wrote: |
Ok, I debugged the code a little bit and it is, indeed possible to set the props in the
as the mixin expects the component to be root one, which is not always possible. If it's not the root component then the listeners are not binded. What I did for workaround for now is to change state of the collection manually but it should be possible to set binding for non-root components as well.
Btw. If it's not the root components the factory approach does not work as well. ( |
Yes using setState for non root components is a solution that I've been Not sure though if using setProps when there's a root component with the Btw, are you using v0.8 of the mixin? On Tuesday, January 27, 2015, Karol Janyst notifications@github.com wrote:
Cumprimentos, |
I'm using 0.7.3 now. About mixing setProps and setState is not a good reactish approach so it should be consistent. I think the wrapper should should use only states as they are dynamic and changing within components scope. Props should be only used to set up the initial state for models/collections within component body. Sharing the models/collections between components and should be taken care by either global referential variables or Flux approach. Maybe I could made some contribution and post PR later this week. |
Feel free to tackle it down. If you do please do it over the master, there are already some changes by using contexts, feature that will be included in the incoming version of React. |
@LKay I'm about to start working on this, Considering what you've mentioned earlier, sharing models/collections between parent and child components can be done cleanly through React contexts, it's already working like that on the master branch. Anyway, the major changes I'm considering for the next release:
I think after the next release the API will get fully stable and we could consider versioning 1.0.0, though I think we should wait for React v1.0.0 release for that to happen (and who knows when that will be). |
v0.8.0-beta.1 is released and it fixes this |
I have a browserify/node kind of application and wanted to use this module to bind backbone collections/models to react components. Unfortunately when I call
fetch()
method on collection/model then component not listening for changes onsync
events. The factory approach does not work in that case as I need a component body. I try to set props such as collections usingsetDefaultProps
. Here is my example file:The text was updated successfully, but these errors were encountered: