-
-
Notifications
You must be signed in to change notification settings - Fork 348
Observable props of observer-ed component #136
Conversation
@mweststrate this PR contains bunch of fixes to reactive props/state. Latest version works perfectly with my current project (with strict mode enabled), so, from my point of view, it is good to merge. |
Thanks for finding and fixing this issue! Looking good. The automatic function conversion is a legacy concern indeed, I'll deprecate that in the next mobx version. I was wondering whether we should actually do something with state. I think we can put that back to it's original check in SCU ( I wanted to wrap this change up, and some related ones, once I am back from ReactiveConf (first week of november). Does that sound OK for you? |
Probably can be released earlier if you need it earlier as official build. Anyway, things left:
|
I am OK to use pre-release build for now, so, it is not need to release it asap. So, devote yourself for ReactiveConf :)
Does this PR breaks it? It defines setter for
I am totally agree with you, but I want from library be as less surprise developer as possible. So, if developer refer to state from computed function, computation result should be invalidated on state changes (without this, developer will spent hours of debugging). |
@mweststrate seems that travis build is broken: I've just added failing test case, which fails |
Still need to avoid double render on props/state modifications.
@mweststrate I've changed the way how props/state observed. |
Prevents infinite recursion.
This helps prevent double-render of component.
Ha though questions! I'm gonna take my time to think this through in two weeks :) But if you find a nice approach in the mean time let me know! |
I've already pushed the fix, done simply with boolean flag :) Just works, maybe there is a better solution :) |
Thanks a lot for your efforts! If you want btw I can make you part of the MobX organization, that allows you to push directly to (branches) of the mobx repo's. And it looks nice on your profile ;-) |
It would be nice;) |
@mweststrate could you please allow me write access to |
Done Op do 20 okt. 2016 om 10:05 schreef Artur Eshenbrener <
|
Make sur eto use a Op do 20 okt. 2016 om 10:18 schreef Michel Weststrate <[email protected]
|
@mweststrate great, thanks. About your note for |
Hi @Arthur, build that are not intended for general consumption should be Op do 20 okt. 2016 om 11:31 schreef Artur Eshenbrener <
|
Published as |
@@ -3,6 +3,7 @@ import React from 'react'; | |||
import ReactDOM from 'react-dom'; | |||
import EventEmitter from './utils/EventEmitter'; | |||
import inject from './inject'; | |||
import debounce from "lodash.debounce"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this dep still needed..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, no, I've forgot about this import. Gonna to remove.
@Strate just testing this PR. Great work, thanks! One question: Do we need to make state observable as well? After all |
Closed in favor of #154 |
Yes, because developer could use state in computed function.
In a fact, state is not optimized from re-render point of view. As you can see, while |
@Strate what I thought indeed. could you add the test case? after that feature should be good to go |
Preferably use the |
This is a potentially breaking change. I've submitted a PR with some doc updates that reflect this change but it may need to be more prominent. Here is a use case where this is a breaking change: https://alexhisen.gitbooks.io/mobx-recipes/content/observable-based-routing.html |
see #124