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

Component needs defaultValue #10

Closed
TimDaub opened this issue Aug 11, 2015 · 2 comments
Closed

Component needs defaultValue #10

TimDaub opened this issue Aug 11, 2015 · 2 comments

Comments

@TimDaub
Copy link

TimDaub commented Aug 11, 2015

Imagine using this component in combination with flux stores.

There can be an initial value a user has previously set in another session that is now submitted to the component via the rating prop.
Unfortunately though, when setting the rating prop initially without clicking on it (and triggering handleClick). this.state.ratingCache is not set.
This has the effect that when the user hovers over a initially set rating component, it basically resets it to no rating at all.

So, there should be either a method/flag or what ever that makes sure that the initial value is set in the cache.

@ninjasort
Copy link
Owner

I agree. When I first created this, I wasn't so clear on the necessity to create stateless components. There are some flaws in the architecture that I'll be working to fix. Feel free to submit a PR if you have any new ideas. Thanks for the suggestion.

@ghan
Copy link

ghan commented Oct 19, 2015

I ran into this issue too. It looks like the component has no componentWillReceiveProps() defined... I was able to fix my issue by adding

componentWillReceiveProps(nextProps) { this.setState({ disabled: nextProps.disabled, editing: nextProps.editing }); }

@ninjasort ninjasort mentioned this issue Nov 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants