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

feat(comp): Add IntervalWrapper to interaction enhancers #1942

Merged
merged 3 commits into from
Jul 30, 2018

Conversation

Kadee80
Copy link
Contributor

@Kadee80 Kadee80 commented Jul 26, 2018

overview

This PR adds IntervalWrapper to interaction enhancers. A follow up PR will be a refactor to replace all RefreshCards in the app with Cards wrapped in IntervalWrappers.

changelog

  • feat(comp): Add IntervalWrapper to interaction enhancers

review requests

Standard review.

@Kadee80 Kadee80 added feature Ticket is a feature request / PR introduces a feature ready for review components Affects the `components` project small labels Jul 26, 2018
@Kadee80 Kadee80 self-assigned this Jul 26, 2018
@Kadee80 Kadee80 requested review from mcous, b-cooper and IanLondon July 26, 2018 17:55
Copy link
Contributor

@mcous mcous left a comment

Choose a reason for hiding this comment

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

Great name 🐩

@codecov
Copy link

codecov bot commented Jul 26, 2018

Codecov Report

Merging #1942 into edge will decrease coverage by 0.04%.
The diff coverage is 0%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
...nents/src/interaction-enhancers/IntervalWrapper.js 0% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 14a54a5...93b043e. Read the comment docs.

Copy link
Contributor

@IanLondon IanLondon left a 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.

Copy link
Contributor

@b-cooper b-cooper left a 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) {
Copy link
Contributor

@b-cooper b-cooper Jul 26, 2018

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

Copy link
Contributor

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?

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'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.

@Kadee80 Kadee80 merged commit 21e1869 into edge Jul 30, 2018
@Kadee80 Kadee80 deleted the compt_interval-wrapper branch July 30, 2018 13:03
b-cooper added a commit that referenced this pull request Aug 6, 2018
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
components Affects the `components` project feature Ticket is a feature request / PR introduces a feature small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants