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

refactor: [M3-6913] Replace Select with Autocomplete in: linodes #10725

Conversation

harsh-akamai
Copy link
Contributor

@harsh-akamai harsh-akamai commented Jul 30, 2024

Description 📝

We want to get rid of our dependency on react-select for accessibility reasons and to consolidate our usage of third-party libraries.

Changes 🔄

  • Replaced all instances of Select with Autocomplete in the Linode feature.

How to test 🧪

Verification steps

(How to verify changes)

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

@harsh-akamai harsh-akamai added the Linodes Dealing with the Linodes section of the app label Jul 30, 2024
@harsh-akamai harsh-akamai self-assigned this Jul 30, 2024
@harsh-akamai harsh-akamai requested a review from a team as a code owner July 30, 2024 12:44
@harsh-akamai harsh-akamai requested review from mjac0bs and cpathipa and removed request for a team July 30, 2024 12:44
@cpathipa
Copy link
Contributor

@harsh-akamai It looks like there are conflicts that need to resolved.

@harsh-akamai harsh-akamai requested a review from a team as a code owner July 31, 2024 11:17
@harsh-akamai harsh-akamai requested review from AzureLatte and removed request for a team July 31, 2024 11:17
@mjac0bs
Copy link
Contributor

mjac0bs commented Jul 31, 2024

I still need to finish confirming the rest of the code changes look good, but the Cypress failures were related to Volumes only, so e2es are looking good otherwise. (We can merge in develop now that Joe merged #10728 to fix the Volumes failures.)

It looks like the last unit test failures are coming from VLANAccordion.test.tsx, where we can't find the placeholder text for 'Create or select a VLAN' ( getByPlaceholderText instead of getByText will fix) and can't find the disabled attributes (this no longer exists on the field with Autocomplete - we might want to find a different way to test that).

Copy link
Contributor

@AzureLatte AzureLatte left a comment

Choose a reason for hiding this comment

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

Test passed

Copy link
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

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

@harsh-akamai, thanks for doing this and keeping up with the test changes in all the various components!

Overall, I didn't see any major regressions. I pointed out a couple of places where we're seeing slightly different behavior from prod, as well as some props that we can clean up a little.

And installing the recommended VSCode extensions I linked and cleaning up the linting warnings also ensures our code is consistently readable.

Copy link

github-actions bot commented Aug 1, 2024

Coverage Report:
Base Coverage: 82.41%
Current Coverage: 82.4%

Copy link
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

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

Thanks for the clean up!

There's an unintended crash in the VPC Panel selection as a result of how we're handling lack of selection that we should fix, and it would be helpful to merge in the latest from develop before your next commit in order to get e2e test passing (all just Volume failures fixed in develop).

Once that feedback is addressed, I'll approve.

@mjac0bs mjac0bs added the Approved Multiple approvals and ready to merge! label Aug 2, 2024
Copy link
Contributor

@cpathipa cpathipa left a comment

Choose a reason for hiding this comment

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

Nice work! I've left a few comments for minor adjustments; otherwise, things LGTM. I believe these efforts have already been addressed in the Linode Create V2 as a long-term solution.
CC: @bnussman

Comment on lines 114 to 121
const vpcDropdownOptions: DropdownOption[] = vpcs.reduce(
(accumulator, vpc) => {
return vpc.region === region
? [...accumulator, { label: vpc.label, value: vpc.id }]
: accumulator;
},
[]
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we wrap this in useCallback hook?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe you meant useMemo? It has been implemented in 20d7eea.

noMarginTop
onChange={() => null}
placeholder="Finnix Media"
options={[]}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it intentional change, passing empty array as options ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. This input field has been disabled by default, which is why options is an empty array.

@@ -9,3 +9,13 @@ export const lishLink = (
) => {
return `ssh -t ${username}@lish-${region}.linode.com ${linodeLabel}`;
};

export const getSelectedDeviceOption = (
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have test coverage for this util ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in 12cb9d8.

@harsh-akamai harsh-akamai merged commit 54fc4c1 into linode:develop Aug 9, 2024
19 checks passed
@harsh-akamai harsh-akamai deleted the feature/M3-6913-replace-select-with-autocomplete-in-linodes branch August 9, 2024 14:49
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! Linodes Dealing with the Linodes section of the app
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants