Skip to content
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

Watch props changes automatically #4

Open
arunoda opened this issue Jan 4, 2016 · 6 comments
Open

Watch props changes automatically #4

arunoda opened this issue Jan 4, 2016 · 6 comments
Labels

Comments

@arunoda
Copy link
Owner

arunoda commented Jan 4, 2016

Get a list of props used by the composer function. Then re-run the composer function if they changed.
This will fix #1

@roberto68
Copy link

do you mean do this const Clock = compose(composerFunction)(Time); https://jsfiddle.net/arunoda/wm6romh for every component like Time - if there's another component like Timer I should do const TimerClock = compose(composerFunction)(Timer);
Second question.
what about the case I've some user initiated update do DB (method call in redux) and then receive changed data from server by subscribing that composerFunction to meteor publish (from server) = not like in you that example to redux store

@arunoda
Copy link
Owner Author

arunoda commented Feb 1, 2016

Hey @roberto68.

I'm sorry but I don't clear the question.

@roberto68
Copy link

I mean rerun the composerFunction. if there is component Timer I should do const TimerClock = compose(composerFunction)(Timer); and I edit that second part of my question, so it should be clear now

@markshust
Copy link
Contributor

markshust commented May 23, 2016

I need to pass props through the container to child components, however it appears that any prop change sent to the container still triggers a rererun.

I looked through the code, and am looking for best way to implement this. Would it make sense to create a new option, sort of like pure, which is named shouldComponentUpdate, and if that prop exists, return that function instead of what's returning here?
https://github.com/kadirahq/react-komposer/blob/master/lib/index.js#L84

Let me know if that approach looks good and I'll submit a PR for this.

@markshust
Copy link
Contributor

Just submitted a PR for a start. This adds a new option shouldComponentUpdate, which receives a function that acts like standard shouldComponentUpdate, except instead of nextState as 2nd param, it is props (this.props).

This only half solves my problem. Is there any way to "pass-through" a param to the child component without triggering a rerun on the container component? I'd like to not rerun the container, but re-render some specific child components.

@sahanDissanayake
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants