-
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
feat(comp): Add IntervalWrapper to interaction enhancers #1942
Conversation
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.
Great name 🐩
Codecov Report
@@ Coverage Diff @@
## edge #1942 +/- ##
==========================================
- Coverage 32.45% 32.41% -0.05%
==========================================
Files 420 421 +1
Lines 6769 6778 +9
==========================================
Hits 2197 2197
- Misses 4572 4581 +9
Continue to review full report at Codecov.
|
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.
Cool! I'm not sure what it's for, but seems neat lol. I wonder if the child will want to have access to resetting or stopping the interval, but that's something you can add if it's needed.
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.
👀 looks good, just one comment
} | ||
|
||
export default class IntervalWrapper extends React.Component<Props, State> { | ||
constructor (props: Props) { |
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.
This component looks good. I wonder though, if the intervalId
would be more suited hung off of the class.
intervalId: ?IntervalId = null
cDM () {
this.intervalId = setInterval(() => {this.props.refresh() }, this.props.interval)
}
cWU () {
if (this.intervalId) {
clearInterval(this.intervalId)
}
}
Also, some circles would consider a direct call to this.setState
in cDM an anti-pattern
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.
Thanks for noting this! I just gave the react docs a quick review. Interval ID in state is nice for debugging, and setState in componentDidMount could be ok because the extra render triggered by the setState will not be seen by the user. Moving intervalID from state to the class itself would get rid of the double render but may be premature optimization? I guess the question is does the niceness of having it in state outweigh performance concerns?
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.
I'm going to leave it in State for now. Once this wrapper is used in several places in the app and we can confirm is all good I'm happy to revisit this convo and optimize further.
* feat(protocol-designer): make pipettes eagerly drop tips (#1946) - drop tips at the end of each step unless the next step for a pipette uses change tip: "never" Closes #1706 * fix(docker): Switch out dumb-init, add modules tools & udev config (#1952) - Switch to Resin's default init system - add avrdude apk & avrdude config file - add udev rules for modules Closes #1822 * feat(comp): Add IntervalWrapper to interaction enhancers (#1942) * fix(protocol-designer): fix styling of pause and mix step items (#1948) Closes #1947 * feat(protocol-designer): add help link to PD nav (#1945) - add 'help-circle' icon - create OutsideLinkButton component for nav - remove negative margin from navbar .bottom - update PD knowledge base URLs Closes #1941 * feat(protocol-designer): add i18next and start with tooltips (#1949) Add the i18next library to help organize our copy, and start off by moving tooltip copy into translations json file. * feat(protocol-designer): refactor and restyle LabwareSelectionModal (#1929) * LabwareSelectionModal component matches design (was AddLabwareModal) * factor out shadows and borders to complib css vars * fix IngredientsList; cleanup borders * make IngredIndividual "hoverable" (presentation only) * fix(api): maintain speed state after collision recovery (#1953) * fix(api): Explicitely set gantry speed after testing an axis for skipping * removes calls to self.set_speed() from driver * fix(api): check virtual smoothie before copying udev file on server start (#1960) * feat(app): Add continuous polling to modules during run (#1961) * feat(api): Add clear method to RPC SessionManager (#1969) * feat(protocol-designer): refactor and restyle timeline terminal items (#1967) - fix bug with `robotStateTimeline` selector creating extra "steps" in the timeline for eager drop tip, introduced in #1706 - fix related bug where substeps didn't generate for `changeTip: "never"` steps - fix bug where hovering over Mix highlights wells of all labware, not just the relevant labware - renamed a handful of selectors touched by this PR to `getSpam` instead of `spam` - create TerminalItem component - change copy of text in initial deck setup, final deck state, and corresponding headers - remove flask icon from initial deck setup - remove `StepTypeWithEnd` and remove `any` typing that was a workaround for it - remove `deckSetupMode` selector - update all places timeline index is used to no longer add 1 to the index to skip over deck setup step (timeline warnings, timeline errors, liquids on deck at step in timeline, well selection) Closes #1930 and closes #1974
overview
This PR adds
IntervalWrapper
to interaction enhancers. A follow up PR will be a refactor to replace allRefreshCards
in the app withCards
wrapped inIntervalWrappers
.changelog
review requests
Standard review.