-
Notifications
You must be signed in to change notification settings - Fork 53
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
Link variants switch behavior #1504
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
const enabled = Boolean(variants); | ||
|
||
const onCheckedChange = (checked: boolean) => { | ||
onVariantsChange(checked ? ["Primary", "Secondary"] : undefined); |
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.
💡 Potential product problem, are we sure we want to reset the variants every time you check / uncheck?
I'm wondering because, let say you're a dev with 5 variants, click accidentally or "just to see" what happens, you will lose existing data.
I would have said that ["Primary", "Secondary"]
would only be the default if you don't have already, no?
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.
my opinion is that resetting is better, especially because adding them is not costly if you accidentally disable it
otherwise, you sometimes will see the default values, and sometimes you won't, and you won't necessarily know why
for instance, see this scenario:
- enable (you see the default options)
- change an option
- disable
- enable (you see the changed option)
- disable
- close the modal without clicking "done"
- enable (you see the default options)
if we always reset, the behavior in those two scenarios would be the same (default options)
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.
I see, I like the consistency argument. Let's just mention that during our daily so Côme knows about it but should be good!
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.
LGTM!
Resolves:
Part of https://linear.app/prismic/issue/DT-2474/aadev-i-can-create-a-link-field-with-the-new-option-to-enable-and
Description
Checking/unchecking the link variants toggle will add two variants ("Primary" and "Secondary") to the model, and update the toggle label.
Checklist
Preview
How to QA 1
Footnotes
Please use these labels when submitting a review:
⚠️ #issue: Strongly suggest a change.
❓ #ask: Ask a question.
💡 #idea: Suggest an idea.
🎉 #nice: Share a compliment. ↩