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

[Vue][ColorPicker] v-model reactivity if select value from ColorPickerArea.Thumb #2713

Closed
1 of 3 tasks
renatodeleao opened this issue Jul 31, 2024 · 0 comments · Fixed by #2821
Closed
1 of 3 tasks
Labels

Comments

@renatodeleao
Copy link
Contributor

renatodeleao commented Jul 31, 2024

Description

Hello. I'm using a controlled version of ColorPicker and, in my wrapped version, I wanted to include a simple "reset to initial color" functionality.

I noticed a very weird exception: after the modelValue was modified by ColorPickerArea.Thumb the reset functionality stopped working, as in, setting modelValue to anything else will not update the "parts" value anymore.

Do note that if you set the modelValue initially or afterwards via any other part (like the channel input) the reset functionality works.

Link to Reproduction (or Detailed Explanation)

https://stackblitz.com/edit/vitejs-vite-ymvzeh?file=src%2Fcomponents%2FAppColorPicker.vue

Steps to Reproduce

  1. Notice that the initial value of the controlled picker is "pink"
  2. Click the color picker trigger
  3. Choose a different color via AreaThumb part.
  4. Notice that modelValue is updated correctly
  5. Click the reset button (which sets color to pink)
  6. Notice that parts are not updated as according to the new modelValue value (which updated)
color-picker-issue.mp4

As seen on the video, if you do same exact steps, but choose a different color via any other ColorPicker part like ChannelInput or Swatch, modelValue and parts are reactive again to the reset action 🤷

Ark UI Version

3.7.2

Framework

  • React
  • Solid
  • Vue

Browser

N/A

Additional Information

  • not sure if related Select.ValueText lost reactivity #2703, but if we use <ColorPicker.Context #default="api"> we can see that api.valueAsString loses reactivity after been modified by the AreaThumb and a new modelValue is set from outside.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants