-
Notifications
You must be signed in to change notification settings - Fork 392
Conversation
So that it can manage its own edit state
still thinking about how to structure the explanation
…hat the comment went under a different list so they are not confused.
Co-Authored-By: vanessayuenn <6842965+vanessayuenn@users.noreply.github.com>
This will let cmd/ctrl-enter fire the github:submit-comment event for review summary editors and existing comment editors, too.
Without this, the "edited" flair doesn't appear on a review comment or summary you edit until you perform a full refetch.
We added a few fields to PullRequestReview and PullRequestReviewComment, so we need to specify some defaults.
Codecov Report
@@ Coverage Diff @@
## master #2124 +/- ##
==========================================
+ Coverage 92.68% 92.72% +0.04%
==========================================
Files 213 215 +2
Lines 12188 12269 +81
Branches 1788 1796 +8
==========================================
+ Hits 11296 11376 +80
- Misses 892 893 +1
Continue to review full report at Codecov.
|
I've removed the callback parameter - using Promise fulfillment will be cleaner - and made the update methods re-throw caught mutation errors. I've also updated the callsite in ActionableReviewView to use await and try/catch to manage editing state. Now if the update mutation fails, users won't lose their edits.
This lets us inject mocks to test menu actions without having to do any crazy Electron shenanigans.
I've got everything but the cancel button tests.
Co-Authored-By: Ash Wilson <smashwilson@gmail.com>
Co-Authored-By: Ash Wilson <smashwilson@gmail.com>
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 great to me! Left a couple of comments, nothing blocking.
If I weren't the PR author I'd submit this with an "Approve"
await this.props.contentUpdater(this.props.originalContent.id, text); | ||
this.setState({editing: false}); | ||
} catch (e) { | ||
this.buffer.setText(text); |
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.
So we'd get to this catch block when the update mutation fails, and if I'm understanding Relay mutations correctly then the optimistic update will automatically get rolled back, and the original text will be restored to the buffer. So I think it may not be necessary to manually restore the text here... though I guess it couldn't hurt to do so and be 100%.
Starting work to address #2112. Will add writeup shortly!
Please be sure to read the contributor's guide to the GitHub package before submitting any pull requests.
Requirements
Description of the Change
Screenshot/Gif
Alternate Designs
Benefits
Possible Drawbacks
Applicable Issues
Metrics
Tests
Documentation
Release Notes
User Experience Research (Optional)