-
-
Notifications
You must be signed in to change notification settings - Fork 259
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
docs(Editable): add Change only on submit
example
#1538
base: main
Are you sure you want to change the base?
Conversation
<template> | ||
<template> | ||
<EditableRoot | ||
:default-value="defaultValue" |
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.
how about using :model-value
instead of default-value
? 🤔
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.
this will not work, I think because of useVModel
inside Editable
, we don't make copy to have ability to edit it, refer to stackblitz and video examples 🙌
Stackblitz: https://stackblitz.com/edit/adsgveqt?file=src%2FApp.vue
Video:
radix-editable-bug.mp4
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.
Thanks @hrynevychroman ! I understand the challenge here now. Looking at the example made me realized this might be a pattern that is quite unintuitive.
I would like to refactor EditableInput
to only update modelValue when we commit it, this inline with the NumberFieldInput
's behavior. So when user commit
the changes, it updates v-model
, if cancel
, nothing happened. I believe this is something you are looking for right?
WDYT?
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.
@zernonia Yeah, this is something I'm looking for, I will take a look and open a PR when I have some free time, probably this Saturday 🙌
0687e1b
to
e14f035
Compare
I have faced some issues with understanding how to make a field editable and not change
v-model
when editing and found this example in the Histoire files of the project, I think that this would be useful for others 😉