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

Fixed editing recurrences #174

Merged
merged 3 commits into from
May 3, 2018
Merged

Fixed editing recurrences #174

merged 3 commits into from
May 3, 2018

Conversation

kylecombes
Copy link
Collaborator

@kylecombes kylecombes commented May 3, 2018

Description

Fixed loading and editing recurring series and single recurrence data. Full testing unfortunately blocked by olin-build/ABE#210. Also fixed some indentation issues.

Required

Changes must conform to these requirements:

  • yarn test passes. All new and existing tests pass.
  • yarn lint passes. All new code follows the code style of this project.

Aspirational

We don't yet require these, but they are nice to have:

  • New code is covered by new or existing tests.
  • Changed code is covered by new or existing tests.

@kylecombes kylecombes added the bug label May 3, 2018
@kylecombes kylecombes requested a review from osteele May 3, 2018 12:02
@@ -28,7 +28,7 @@ rules:
no-alert: warn
no-mixed-operators: warn
no-param-reassign: warn
no-plusplus: warn
no-plusplus: off
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why would we want this? It ends up highlighting for loops.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's from the Airbnb style guide, included by the airbnb preset.

My approach to the eslint file was to use the Airbnb preset, and then override its errors with warnings to buy us time to fix them.

I don't have a strong opinion on disabling particular warnings. ESlint's rationale for this one seems weak, given that the code is being babelized anyway.

That said, a weaker alternative to off is [warn, allowForLoopAfterthoughts: true] “allows unary operators ++ and -- in the afterthought (final expression) of a for loop."

// If the labels are null/undefined, create an empty list in our state
if (!eventData.labels) { eventData.labels = []; }
const { eventData } = this.state;
if (this.state.eventData) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this.state.eventData -> eventData ?


descriptionChanged = description => this.updateEventDatum({ description });
arraysEqual = (arr1, arr2) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

The project already has a runtime dependency on lodash (because this is used by async, react-tag-input, input-moment, react-dnd, react-redux, redux, and react-tag-input), so you could also use _.isEqual.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nifty...

);
}

const editingExisting = this.state.eventData.id || this.state.eventData.sid;
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that editingExisting has a type string | undefined. (This isn't quite the same as Flow's ?string, because undefined !== null.) I think that's okay the way it's used here. To assure it's a boolean, you could use Boolean(this.state.eventData.id) || Boolean(this.state.eventData.sid) or Boolean(this.state.eventData.id || this.state.eventData.sid).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, it should be fine.

Copy link
Contributor

@osteele osteele left a comment

Choose a reason for hiding this comment

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

Look over line comments, and ignore or revise — approved either way.

@kylecombes kylecombes merged commit 349a7a2 into dev May 3, 2018
@kylecombes kylecombes deleted the kyle/add-edit-fixes branch May 3, 2018 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants