Skip to content

Fixed reactivity of colors prop for rate component#6872

Merged
Leopoldthecoder merged 3 commits intoElemeFE:devfrom
lukaszb:fix/rate-colors-reactivity
Sep 6, 2017
Merged

Fixed reactivity of colors prop for rate component#6872
Leopoldthecoder merged 3 commits intoElemeFE:devfrom
lukaszb:fix/rate-colors-reactivity

Conversation

@lukaszb
Copy link
Copy Markdown
Contributor

@lukaszb lukaszb commented Sep 5, 2017

Please make sure these boxes are checked before submitting your PR, thank you!

  • Make sure you follow Element's contributing guide (中文 | English).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer relative issues for you PR.

What I wanted is to allow user to rate some items and also see other users's average rating. Until user rates the item herself that average rating should be "muted" (dimmed colors), so I wanted to pass colors prop. However, I then noticed that changing that colors array at parent component have no impact on the colors at rate component. Looking at the code I can see that colorMap is prepared once at the created hook. This makes colors prop non-reactive which is odd.

I've made colorMap a computed value that should be based on colors prop.

@Leopoldthecoder Leopoldthecoder merged commit 0e0f234 into ElemeFE:dev Sep 6, 2017
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

Successfully merging this pull request may close these issues.

2 participants