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

Upgrade React Select #16027

Merged
merged 4 commits into from
Sep 13, 2022
Merged

Upgrade React Select #16027

merged 4 commits into from
Sep 13, 2022

Conversation

krishnaglick
Copy link
Contributor

@krishnaglick krishnaglick commented Aug 26, 2022

Resolves #16023

The old react-select setup made a lot of assumptions, abused certain facets of the library, and had some weird typing errors.
This upgrade is intended to put us in a better position for changes and improvements in the future. A number of the assumptions that were made still exist and will likely need a full rewrite in the future to increase maintainability.

For the future of our use of react-select, I feel like we should be able to get away from the whole components={components} and instead reference things more simply, and with better types. That would be a larger refactor that what's reasonable here however.

@krishnaglick krishnaglick requested a review from a team as a code owner August 26, 2022 19:39
@github-actions github-actions bot added area/platform issues related to the platform area/frontend Related to the Airbyte webapp labels Aug 26, 2022
@teallarson
Copy link
Contributor

A few notes:

  • The issue mentioned nixing the styled components for dropdowns, but I still see CustomSelect is a styled component.
  • Wow a bunch of the types got more complex... but seemingly more accurate as to what they're actually representing
  • Wondering what you believe in here should be a future rewrite. You mentioned it in the PR and I'm wondering what stands out to you here.
  • left one other specific comment about accessibility/testing

@@ -24,7 +24,8 @@ const Separator = styled.div`
padding: 0 5px;
`;

const SingleValue: React.FC<IProps> = (props) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const SingleValue: React.FC<IProps<any>> = (props) => {
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 think the weird component prop-drilling could be refactored out so these could be correctly typed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

While I agree with splitting this apart if possible, is there any way we can go with unknown for now. The any here currently actually allows us to access props.data.value below, while props.data could actually be undefined (at least according to types) and then throw us an exception at runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed!

@krishnaglick
Copy link
Contributor Author

A few notes:

* The issue mentioned nixing the styled components for dropdowns, but I still see `CustomSelect` is a styled component.

* Wondering what you believe in here should be a future rewrite.  You mentioned it in the PR and I'm wondering what stands out to you here.
  1. Fixed, though it was less clean than I'd like.
  2. I updated the PR description to include my thoughts.

@krishnaglick krishnaglick requested review from teallarson and removed request for teallarson September 1, 2022 19:14
Copy link
Contributor

@teallarson teallarson left a comment

Choose a reason for hiding this comment

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

Tested locally but haven't looked deeply at the code yet.

Looks like at least this dropdown on connector setup is missing a handful of styles:
Screen Shot 2022-09-08 at 9 04 54 AM

@krishnaglick
Copy link
Contributor Author

Tested locally but haven't looked deeply at the code yet.

Looks like at least this dropdown on connector setup is missing a handful of styles: Screen Shot 2022-09-08 at 9 04 54 AM

Pulled out the styled components removal work as it quickly got overly complex. This is "fixed"

Copy link
Contributor

@teallarson teallarson left a comment

Choose a reason for hiding this comment

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

Tested locally and did not find any visual or functional regression

@krishnaglick krishnaglick merged commit 11925f9 into master Sep 13, 2022
@krishnaglick krishnaglick deleted the kc/upgrade-react-select branch September 13, 2022 13:45
robbinhan pushed a commit to robbinhan/airbyte that referenced this pull request Sep 29, 2022
* I'm not in love with the end result here, but it's been upgraded and compiles.

* Fixing overflow text issue

* Tim CR
jhammarstedt pushed a commit to jhammarstedt/airbyte that referenced this pull request Oct 31, 2022
* I'm not in love with the end result here, but it's been upgraded and compiles.

* Fixing overflow text issue

* Tim CR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend Related to the Airbyte webapp area/platform issues related to the platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade react-select
3 participants