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

fix: [M3-8588] - Fix value selection issue in ImageSelect #11007

Merged
merged 8 commits into from
Sep 27, 2024

Conversation

carrillo-erik
Copy link
Contributor

@carrillo-erik carrillo-erik commented Sep 25, 2024

Description 📝

This PR fixes the bug in the ImageSelect component which resulted in the selected value getting cleared after the input lost focus.

Changes 🔄

List any change relevant to the reviewer.

  • Add logic to handle the case when value is undefined initially.
  • Remove leftover default export declarations.
  • Replace single letter variables with more meaningful names.

Target release date 🗓️

10/16/2024

Preview 📷

Before After
BEFORE.mov
AFTER.mov

How to test 🧪

Prerequisites

(How to setup test environment)

  • Choose a Linode from your list of Linodes to work with and power it down.
  • Visit the Storage tab for your chosen Linode.
  • Resize any of the Disks in order to enable the Add A Disk option.
  • Click on the Add A Disk button to open the Create Disk drawer.
  • Click on the Create from Image radio option.

Verification steps

(How to verify changes)

  • Select an Image from the Image dropdown menu.
  • Interact with any other field in the drawer (ex. Label, Root Password, Size).
  • Verify that the value selected in the Image dropdown component remains after you have focused out of the component and focused into another field in the drawer.
  • Verify that the Add A Disk feature works as expected.

As an Author I have considered 🤔

Check all that apply

  • 👀 Doing a self review
  • ❔ Our contribution guidelines
  • 🤏 Splitting feature into small PRs
  • ➕ Adding a changeset
  • 🧪 Providing/Improving test coverage
  • 🔐 Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • 👣 Providing comprehensive reproduction steps
  • 📑 Providing or updating our documentation
  • 🕛 Scheduling a pair reviewing session
  • 📱 Providing mobile support
  • ♿ Providing accessibility support

@carrillo-erik carrillo-erik added the Bug Fixes for regressions or bugs label Sep 25, 2024
@carrillo-erik carrillo-erik self-assigned this Sep 25, 2024
@carrillo-erik carrillo-erik requested a review from a team as a code owner September 25, 2024 19:54
@carrillo-erik carrillo-erik requested review from bnussman-akamai and hana-akamai and removed request for a team September 25, 2024 19:54
Copy link

github-actions bot commented Sep 25, 2024

Coverage Report:
Base Coverage: 86.98%
Current Coverage: 86.98%

@hana-akamai hana-akamai added the Add'tl Approval Needed Waiting on another approval! label Sep 26, 2024
@@ -518,6 +518,6 @@ export const UpdateLinodeDiskSchema = object({

export const CreateLinodeDiskFromImageSchema = CreateLinodeDiskSchema.clone().shape(
{
image: string().required('An image is required.'),
image: string().required('An image is required.').nullable(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change is done to remove the validation error message after a user has selected a value from the ImageSelect and then clears the value (input).

Screenshot 2024-09-26 at 9 13 25 AM

Copy link
Member

Choose a reason for hiding this comment

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

Yup's .typeError might be more fitting here than nullable

Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we could use ImageSelectv2 here instead. This ImageSelect has some serious type safety issues and hackyness

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bnussman-akamai I agree with your concerns about the type safety issues and the hackyness feeling. I gave ImageSelectv2 a try and it appears that with some minor changes it should work within the CreateDiskDrawer.

The one issue I noticed is the way the options are grouped. In the current ImageSelect, one the three categories is the recommended 64-bit distributions. In the ImageSelectv2, they are grouped by vendor. Would require some conditional logic to determine with grouping function to use.

ImageSelect
ImageSelect
ImageSelectv2
ImageSelectv2

Copy link
Member

Choose a reason for hiding this comment

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

Ah good point. That would require some UX / product consideration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bnussman-akamai To keep the work within the scope of this ticket, I'll create a separate ticket for UX to consider the grouping logic and see if it would make sense to further replace the original ImageSelect with the ImageSelectv2 component. Could please review and approve this for now. Thanks.

@@ -518,6 +518,6 @@ export const UpdateLinodeDiskSchema = object({

export const CreateLinodeDiskFromImageSchema = CreateLinodeDiskSchema.clone().shape(
{
image: string().required('An image is required.'),
image: string().required('An image is required.').nullable(),
Copy link
Member

Choose a reason for hiding this comment

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

Yup's .typeError might be more fitting here than nullable

@bnussman-akamai bnussman-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels Sep 27, 2024
@carrillo-erik carrillo-erik merged commit 744b26b into linode:develop Sep 27, 2024
20 checks passed
Copy link

cypress bot commented Sep 27, 2024

Cloud Manager E2E    Run #6583

Run Properties:  status check passed Passed #6583  •  git commit 744b26bc95: fix: [M3-8588] - Fix `value` selection issue in `ImageSelect` (#11007)
Project Cloud Manager E2E
Branch Review develop
Run status status check passed Passed #6583
Run duration 23m 43s
Commit git commit 744b26bc95: fix: [M3-8588] - Fix `value` selection issue in `ImageSelect` (#11007)
Committer carrillo-erik
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 408
View all changes introduced in this branch ↗︎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! Bug Fixes for regressions or bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants