-
Notifications
You must be signed in to change notification settings - Fork 179
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(protocol-designer): remove usage of class components and connect fns #14331
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## edge #14331 +/- ##
==========================================
+ Coverage 68.02% 68.08% +0.05%
==========================================
Files 2505 2498 -7
Lines 71556 71540 -16
Branches 9082 9086 +4
==========================================
+ Hits 48679 48710 +31
+ Misses 20767 20713 -54
- Partials 2110 2117 +7
Flags with carried forward coverage won't be shown. Click here to find out more.
|
protocol-designer/src/components/DeckSetup/LabwareOverlays/EditLabwareOffDeck.tsx
Outdated
Show resolved
Hide resolved
protocol-designer/src/components/DeckSetup/LabwareOverlays/EditLabwareOffDeck.tsx
Outdated
Show resolved
Hide resolved
protocol-designer/src/components/DeckSetup/LabwareOverlays/LabwareName.tsx
Outdated
Show resolved
Hide resolved
protocol-designer/src/components/DeckSetup/LabwareOverlays/NameThisLabware.tsx
Outdated
Show resolved
Hide resolved
protocol-designer/src/components/IngredientsList/LabwareDetailsCard/LabwareDetailsCard.tsx
Outdated
Show resolved
Hide resolved
protocol-designer/src/components/LabwareSelectionModal/LabwareSelectionModal.tsx
Outdated
Show resolved
Hide resolved
protocol-designer/src/components/StepEditForm/fields/DisposalVolumeField.tsx
Outdated
Show resolved
Hide resolved
protocol-designer/src/components/StepEditForm/fields/TipPositionField/index.tsx
Outdated
Show resolved
Hide resolved
protocol-designer/src/components/StepEditForm/fields/WellOrderField/WellOrderModal.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smoke test and a cursory pass through looks good. This was a lot of work, well done! 🚀
Just curious, why were some of these written as arrow functions?
|
||
const missingTipsByLabwareId = tipContentsSelectors.getMissingTipsByLabwareId( | ||
state | ||
export const LabwareOnDeck = (props: LabwareOnDeckProps): JSX.Element => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As Jamey pointed out
export const LabwareOnDeck = (props: LabwareOnDeckProps): JSX.Element => { | |
export function LabwareOnDeck = (props: LabwareOnDeckProps): JSX.Element { |
I think we follow airbnb styling guidelines and I'm not sure about pd but in app we utilize hoisting
to create a component inside component.
https://airbnb.io/javascript/react/
// bad
class Listing extends React.Component {
render() {
return <div>{this.props.hello}</div>;
}
}
// bad (relying on function name inference is discouraged)
const Listing = ({ hello }) => (
<div>{hello}</div>
);
// good
function Listing({ hello }) {
return <div>{hello}</div>;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for this Koji! Very helpful. I'll refactor.
protocol-designer/src/components/DeckSetup/LabwareOverlays/EditLabwareOffDeck.tsx
Outdated
Show resolved
Hide resolved
protocol-designer/src/components/DeckSetup/LabwareOverlays/LabwareName.tsx
Outdated
Show resolved
Hide resolved
protocol-designer/src/components/DeckSetup/LabwareOverlays/NameThisLabware.tsx
Outdated
Show resolved
Hide resolved
protocol-designer/src/components/LabwareSelectionModal/LabwareSelectionModal.tsx
Outdated
Show resolved
Hide resolved
protocol-designer/src/components/SettingsPage/FeatureFlagCard/FeatureFlagCard.tsx
Outdated
Show resolved
Hide resolved
@mjhuff, ah good catch, i'm reading through Koji's comments. I'll refactor them! I'll admit that i wasn't really sure of the differences 😓 but it is a good idea to be consistent across PD and the app |
closes RAUT-935
Overview
This PR refactors out the usage of the majority of connect functions and all class components. The connect functions I left were because they use react-dnd
Test Plan
smoke test Pd! make sure things work as expected and that you don't run into any white screens or buttons that don't work.
Changelog
class
componentsconnect
functionsReview requests
see test plan
Risk assessment
medium-ish, touches a lot of code but there is no release coming anytime soon