-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Conversation
Now using a data model based on GraphQL (or at least a hypothetical future version of the GraphQL API based on conversations with that team).
Should really be using `ActorAvatarView` here but our mess of assemblies means that it'd have to be moved. Fix later.
If the basic logic doesn't work, likely the data is bad.
...`PullRequestUserReviewsViewModelTests`. The view now loads instantly :D
Mainly merging #1701 Conflicts: src/GitHub.Exports.Reactive/Services/IPullRequestSession.cs src/GitHub.InlineReviews/SampleData/CommentThreadViewModelDesigner.cs src/GitHub.InlineReviews/Services/IPullRequestSessionService.cs src/GitHub.InlineReviews/Services/PullRequestSession.cs src/GitHub.InlineReviews/Services/PullRequestSessionService.cs src/GitHub.InlineReviews/ViewModels/CommentThreadViewModel.cs src/GitHub.InlineReviews/ViewModels/CommentViewModel.cs src/GitHub.InlineReviews/ViewModels/ICommentThreadViewModel.cs test/GitHub.InlineReviews.UnitTests/ViewModels/PullRequestReviewCommentViewModelTests.cs
Because adding e.g. a PR review comment affects both the `PullRequestReviewModel` _and_ the `PullRequestDetailModel`, re-read the PR when a comment mutation is executed.
4bdfc55
to
e849c1b
Compare
The placeholder should be in `Editing` state when it is shown.
@@ -10,6 +10,11 @@ namespace GitHub.InlineReviews.UnitTests.ViewModels | |||
{ | |||
public class NewInlineCommentThreadViewModelTests | |||
{ | |||
public NewInlineCommentThreadViewModelTests() | |||
{ | |||
Splat.ModeDetector.Current.SetInUnitTestRunner(true); |
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.
We should probably move this into an assembly wide setup for the whole test assembly. This is possible with NUnit in a way it wasn't with xUnit.
For example we could move it into AssemblyInfo.cs
like this:
Splat.ModeDetector.Current.SetInUnitTestRunner(true); |
Otherwise it's too easy to forget and end up with hanging or not depending on the order they're executed. 😨
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.
Alternatively we could do this as part of #1721, which I think would make more sense. 😉
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 like how you've cleaned up the models. :-) Just a few questions, no blockers.
@@ -105,6 +105,7 @@ public void Dispose() | |||
{ string.Empty, new PullRequestDirectoryNode(string.Empty) } | |||
}; | |||
|
|||
await Task.Delay(0); |
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.
What is the Task.Delay(0)
for? Would this behave the same with Task.Yield()
?
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.
Oops, that was left in from when I commented out the whole of the method. Putting a Task.Delay(0)
in was my way of preventing the "method doesn't use await" error. Will remove.
if (readPullRequest == null) | ||
{ | ||
readPullRequest = new Query() | ||
.Repository(Var(nameof(owner)), Var(nameof(name))) |
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 curious why you're caching the compiled query here but not other queries? I've found an easy way to automatically handle the named arguments and caching if this is something users of GraphQL should be doing.
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.
Basically just because this was written from scratch and the other queries were just modified. We should probably be doing the same with the other queries, not sure if that should be in this PR or another?
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.
Can I show you my GraphQL prototype before we do the the same with the other queries? I'd like to find out if you think it's a good idea in principle before developing it any further. So maybe push this to another PR.
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 wanted to get your thoughts on this:
octokit/octokit.graphql.net#104
@@ -15,9 +16,9 @@ | |||
|
|||
<d:DesignData.DataContext> | |||
<vm:PullRequestReviewSummaryViewModel Id="1" State="Pending" FileCommentCount="2"> | |||
<vm:PullRequestReviewSummaryViewModel.User> | |||
<!--<vm:PullRequestReviewSummaryViewModel.User> |
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.
Is this commented out for a reason?
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.
Fixed.
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.
There seems to be an issue when attempting to leave comments on some files.
Above I'm attempting to leave a comment on the following line of this PR:
https://github.com/jcansdale/VisualStudio/blob/df6aa658a185620d61e3398656871cf27c3ae02f/src/GitHub.App/ViewModels/GitHubPane/PullRequestReviewCommentViewModel.cs#L66
@jcansdale are you sure this was caused by this PR? This doesn't look like anything that this PR should have changed. Can you leave a comment in the same position on master? |
@grokys @jcansdale I just tried to leave a comment in the same position on master and I do see this same error happening. |
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.
Sorry about the position is invalid
false alarm!
This PR looks good. 👍
Conflicts: src/GitHub.Exports.Reactive/Services/IPullRequestSession.cs src/GitHub.InlineReviews/Services/IPullRequestSessionService.cs src/GitHub.InlineReviews/Services/PullRequestSession.cs src/GitHub.InlineReviews/Services/PullRequestSessionService.cs src/GitHub.InlineReviews/ViewModels/InlineCommentThreadViewModel.cs test/GitHub.InlineReviews.UnitTests/Services/PullRequestSessionTests.cs test/GitHub.InlineReviews.UnitTests/ViewModels/InlineCommentThreadViewModelTests.cs
Description
Previously we were using a mix of REST and GraphQL for Pull Requests and Pull Request Reviews, and our data model didn't fit either very well. This PR:
PullRequestDetailModel
which is modeled after what we're hoping will be the future shape of the GraphQL pull request/reviews APIModelService
and intoPullRequestSession
- this is now the only place to get hold of a PR details model. Doing this means that all parts of the extension always agree about the state of a pull request, and prevents some unnecessary API reads that we were carrying out before - our UI should feel a lot snappier now!PullRequestDetailModel
using GraphQL. Because the GraphQL API for reviews and comments isn't complete yet, after reading this we massage the model into what should be the final shape after reading (seeBuildPullRequestThreads
The old
PullRequestModel
is still there (although in a cut-down form) and still read using REST. It is now used just for the PR list. This will be moved to GraphQL in a later PR.Testing
Basically, everything around pull requests/reviews/comments should work as before!
TODO
Mutation
object for auto-paging and failing