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

[Products] Empty option on unit scale dropdown #12969

Conversation

chahmedejaz
Copy link
Collaborator

@chahmedejaz chahmedejaz commented Nov 9, 2024

What? Why?

What should we test?

  • Add a new variant for the product on the products page
  • Please make sure that you can view "Select unit scale" as first option for the unit scale field.

Release notes

Changelog Category (reviewers may add a label for the release notes):

  • User facing changes
  • API changes (V0, V1, DFC or Webhook)
  • Technical changes only
  • Feature toggled

@chahmedejaz chahmedejaz changed the title 12919: remove empty option from unit scale dropdown [Products page] Empty option on unit scale dropdown Nov 9, 2024
@chahmedejaz chahmedejaz added bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround. user facing changes Thes pull requests affect the user experience labels Nov 9, 2024
@chahmedejaz chahmedejaz force-pushed the task/12919-remove-empty-option-from-unit-scale-dropdown branch from cd6b2ae to bafb881 Compare November 10, 2024 09:58
@chahmedejaz chahmedejaz marked this pull request as draft November 10, 2024 10:02
@chahmedejaz chahmedejaz marked this pull request as ready for review November 11, 2024 23:13
Copy link
Member

@dacook dacook left a comment

Choose a reason for hiding this comment

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

From what I can see, the include_blank option was added here, perhaps to handle bad data.

Does this mean that every dropdown now has a blank "select unit scale" option? I think it would be ideal if we show "select unit scale" only when data is blank. Is that possible?

@sigmundpetersen sigmundpetersen changed the title [Products page] Empty option on unit scale dropdown [Products] Empty option on unit scale dropdown Nov 19, 2024
@chahmedejaz
Copy link
Collaborator Author

From what I can see, the include_blank option was added here, perhaps to handle bad data.

Does this mean that every dropdown now has a blank "select unit scale" option? I think it would be ideal if we show "select unit scale" only when data is blank. Is that possible?

@dacook - Sorry this comment skipped my radar.
I believe this is the same behavior with other drop-downs like tax category or producer that we always show the prompt in the options for every drop-down. In my opinion, it would make more sense if all the drop-downs follow the same behavior? What do you say?

If we want to incorporate this, I don't think it would be much effort. Thanks.

Copy link
Member

@dacook dacook left a comment

Choose a reason for hiding this comment

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

In my opinion, it would make more sense if all the drop-downs follow the same behavior? What do you say?

Thanks Ahmed, that's a good point 👍

Let's proceed as-is without adding effort, and if further improvement is needed we can raise an issue to work out the best solution.

@dacook
Copy link
Member

dacook commented Nov 20, 2024

Skipping second review as it's a simple change. Ready for testing 🧪

@filipefurtad0 filipefurtad0 self-assigned this Nov 28, 2024
@filipefurtad0 filipefurtad0 added the pr-staged-uk staging.openfoodnetwork.org.uk label Nov 28, 2024
@filipefurtad0
Copy link
Contributor

Hey @chahmedejaz ,

I've verified the issue is still present in current master:

image

image

Creating a new variant displays the empty option on the unit scale dropdown:

image

After this PR

  • For existing variants
    The empty option has the correct size and displays the "Select unit size" label
    Selecting this option triggers a change, but does not allow saving this change -> this is the correct behavior, as it would remove a previously attributed unit scale

image

  • for new variants
    The default option is the new "Select unit size" label

image

I've tested that this dropdown works otherwise as before: allows changing units for existing variants or creating new variants

This looks great 🎉
Awesome.
Merging.

@filipefurtad0 filipefurtad0 merged commit 58d174f into openfoodfoundation:master Nov 28, 2024
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround. pr-staged-uk staging.openfoodnetwork.org.uk user facing changes Thes pull requests affect the user experience
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Products page] Empty option on unit scale dropdown
3 participants