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-6478] - Make <Select /> type safe #8986

Merged

Conversation

bnussman-akamai
Copy link
Member

@bnussman-akamai bnussman-akamai commented Apr 11, 2023

Description πŸ“

Why ❓

  • You may have not noticed, but the Select component had basically zero type-safety resulting in very bad developer experience and opens the possibility for bugs. It has been like this for years πŸ˜₯
  • Refer to the before and after

Description

  • Does a refactor / improvement of the "Enhanced" Select component
  • The goal isn't to make the component perfect (because it is super messed up), but the goal is to make it better
  • Putting it up as a draft to get e2e test feedback and feedback from team

Impact πŸ“·

Before πŸ‘ŽπŸΌ After πŸŽ‰
Screenshot 2023-04-11 at 8 47 10 PM Screenshot 2023-04-11 at 8 46 17 PM
Before πŸ‘ŽπŸΌ After πŸŽ‰
Screenshot 2023-04-11 at 9 01 57 PM Screenshot 2023-04-11 at 9 03 07 PM

Before πŸ‘ŽπŸΌ

Screen.Recording.2023-04-11.at.9.12.13.PM.mov

After πŸŽ‰

Screen.Recording.2023-04-11.at.9.11.18.PM.mov

How to test πŸ§ͺ

  • Test places in the app that use a "Enhanced" Select Component
    • I recommend looking at the diff and going to each of the <Select /> components that were modified and testing the functionality.
  • The e2e tests (once they are working) should also help check for bugs

@bnussman-akamai
Copy link
Member Author

e2e tests results 9e2b98d

Screenshot 2023-04-11 at 10 35 55 PM

@bnussman-akamai
Copy link
Member Author

Little bonus feature worth mentioning. If the select is clearable, the onChange type updates dynamically ✨

If a select is clearable, the onChange value could be null (the user hits the clear button)
If a select is NOT clearable, the onChange value will always be a defined item.

The types now properly reflect this πŸŽ‰ Notice how in the video the type of item is different depending on the clearable prop

Screen.Recording.2023-04-11.at.11.44.16.PM.mov

@bnussman-akamai bnussman-akamai changed the title refactor: Make <Select /> type safe refactor: [M3-6478] - Make <Select /> type safe Apr 13, 2023
@bnussman-akamai bnussman-akamai added the Add'tl Approval Needed Waiting on another approval! label Apr 14, 2023
@cypress
Copy link

cypress bot commented Apr 14, 2023

Passing run #2979 β†—οΈŽ

0 149 3 0 Flakiness 0

Details:

Merge branch 'develop' into refactor/make-select-typesafe
Project: Cloud Manager E2E Commit: 73f2ad4138
Status: Passed Duration: 13:47 πŸ’‘
Started: Apr 14, 2023 4:40 PM Ended: Apr 14, 2023 4:54 PM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

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!

@cpathipa cpathipa added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels Apr 14, 2023
@bnussman-akamai bnussman-akamai merged commit 65b6b01 into linode:develop Apr 14, 2023
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! Enhancement Ready for Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants