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

Link variants switch behavior #1504

Merged
merged 2 commits into from
Dec 13, 2024
Merged

Conversation

dani-mp
Copy link
Contributor

@dani-mp dani-mp commented Dec 13, 2024

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

  • A comprehensive Linear ticket, providing sufficient context and details to facilitate the review of the PR, is linked to the PR.
  • If my changes require tests, I added them.
  • If my changes affect backward compatibility, it has been discussed.
  • If my changes require an update to the CONTRIBUTING.md guide, I updated it.

Preview

How to QA 1

Footnotes

  1. Please use these labels when submitting a review:
    ❓ #ask: Ask a question.
    💡 #idea: Suggest an idea.
    ⚠️ #issue: Strongly suggest a change.
    🎉 #nice: Share a compliment.

@dani-mp dani-mp requested a review from a team as a code owner December 13, 2024 11:59
Copy link

vercel bot commented Dec 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
slice-machine ✅ Ready (Inspect) Visit Preview Dec 13, 2024 0:04am

const enabled = Boolean(variants);

const onCheckedChange = (checked: boolean) => {
onVariantsChange(checked ? ["Primary", "Secondary"] : undefined);
Copy link
Collaborator

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?

Copy link
Contributor Author

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:

  1. enable (you see the default options)
  2. change an option
  3. disable
  4. enable (you see the changed option)
  5. disable
  6. close the modal without clicking "done"
  7. enable (you see the default options)

if we always reset, the behavior in those two scenarios would be the same (default options)

Copy link
Collaborator

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!

Copy link
Collaborator

@xrutayisire xrutayisire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dani-mp dani-mp merged commit fc58398 into dani/link-variant Dec 13, 2024
32 of 33 checks passed
@dani-mp dani-mp deleted the dani/link-variant-2 branch December 13, 2024 12:36
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