Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Speed up PR list and other improvements #1737

Merged
merged 41 commits into from
Jul 4, 2018
Merged

Speed up PR list and other improvements #1737

merged 41 commits into from
Jul 4, 2018

Conversation

grokys
Copy link
Contributor

@grokys grokys commented Jun 15, 2018

This PR refactors the PR list to:

Use GraphQL for loading

By using GraphQL we can load only the fields we're interested in, which speeds up our queries.

Use data virtualization so that only visible items will be loaded

Previously, when the GitHub pane was opened, all pull requests were loaded. This could take minutes for repositories with a lot of pull requests, and the whole time they were loading VS would be slow.

With this PR, only the first 100 PRs will be loaded when the GitHub pane is shown, which is a single request. When the user scrolls down, more PRs will be loaded on demand.

Display a message when no items found

We currently have two messages:

When no filters are active and no PRs are found:

image

When filters are active and no PRs are found:

image

  • Improve the author filter

The author filter is now searchable:

image

Unfortunately because we're now only loading the first page of results, we don't have a full list of all users that have opened a PR, instead we use the GraphQL "Assignable Users" endpoint to get a list similar to on .com and allow the user to also select logins that they enter that aren't on that list.

Depends on #1712

@grokys grokys added the WIP label Jun 15, 2018
@grokys grokys force-pushed the refactor/pr-list branch from 4ce5a0a to 373226f Compare June 17, 2018 14:02
@meaghanlewis meaghanlewis added this to the 2.5.4 milestone Jun 18, 2018
@meaghanlewis
Copy link
Contributor

@grokys Dogfooding this and am so impressed with all the improvements to the PR list! 💥

Leaving some feedback and questions. I know this is still WIP so apologies if you're already addressing some of these things.

General feedback (and screenshots 😄 )

  • The new PR list is looking so smooth. It's nice to tell from a glance things like which PR branch I'm on, how many comments a PR has, and the number of open/closed/all PRs.
    new pr list

  • I love the new PR author filter!
    new author filter

  • And the view when there are no PR's is great too.
    no prs

Things to fix

  • No link to open PR in browser
    no link on pr

  • Link to open pulls in browser doesn't do anything
    link to open pulls doesnt work

Questions

  • When the PR list is still loading the count shows 0 for PRs. I think it's fine as is, but wondering if it would be possible to not show this count until it's loaded?
    loading prs

  • When there are no PRs the author filter shows but there is nothing to filter so this option doesn't really do anything. Is it possible to not show this filter or the count of PRs here?
    filter when no prs

cc @donokuda for thoughts on the above questions ^

@donokuda
Copy link
Contributor

FYI: After chatting with @grokys, we're going to move any design discussions to a separate issue so that this pull request can stay focused on refactoring instead of redesigning 😄

@donokuda
Copy link
Contributor

Out of curiosity, what is the timestamp of each PR list item referencing? It looks like it's something other than the time it was opened. Would it make sense to use the "Opened at" date instead?

@simurai
Copy link
Member

simurai commented Jul 2, 2018

Would it make sense to use the "Opened at" date instead?

👍

.com allows to sort by "Least recently updated". It's interesting because it highlights which are the more "active" PRs. There could be "old" PRs that just take a while, but still get updated regularly.

On the other hand, sorted by "Newest" makes the list much more constant/predictable. There is no random re-ordering and new PRs just show up at the top. Maybe good to show that as the default.

@donokuda
Copy link
Contributor

donokuda commented Jul 2, 2018

On the other hand, sorted by "Newest" makes the list much more constant/predictable. There is no random re-ordering and new PRs just show up at the top. Maybe good to show that as the default.

Yeah, I think if we're settled on sorting by recently updated, then we should consider reflecting that in the timestamp (like what you mentioned that .com does.)

@grokys grokys changed the title WIP: Refactoring PR list Refactoring PR list Jul 4, 2018
@grokys
Copy link
Contributor Author

grokys commented Jul 4, 2018

This PR is now ready for review! There's still some discussion around #1768 so I've not merged that in yet. If a decision is made before this PR is merged, then we can merge it in here, otherwise it can be made to master.

Copy link
Collaborator

@jcansdale jcansdale left a comment

Choose a reason for hiding this comment

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

This looks and works great!

Just spotted a typo and suggested generalizing a method.

this.graphqlFactory = graphqlFactory;
}

public async Task<string> ReadParentOwnerLogin(HostAddress address, string owner, string name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if this would be more useful as a general FindParent method that returns a (string owner, string repositoryName)? A parent repository might not have the same name as its child and we may want to support this as some point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yeah, good point. I will make this change.

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 changed this to return the repository name and owner. We don't actually use the name yet,: UriString doesn't support getting a new URL with a different name as well as owner so want to do that in a separate PR, this is big enough as it is ;)

/// </summary>
/// <typeparam name="T">The item type.</typeparam>
/// <remarks>
/// This interface is used the the <see cref="VirtualizingList{T}"/> class to load pages of data.
Copy link
Collaborator

Choose a reason for hiding this comment

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

"by the" not "the the"?

grokys added 3 commits July 4, 2018 14:49
Make the method to find the parent repository return the repository name and owner. We don't actually use the `name` yet, and assume that forks have the same name as the parent repository. This is usually the case but not always. `UriString` doesn't support getting a new URL with a different name as well as owner so want to do that in a separate PR.
@grokys grokys merged commit 1d801fb into master Jul 4, 2018
@grokys grokys changed the title Refactoring PR list Refactored PR list Jul 10, 2018
@grokys grokys changed the title Refactored PR list Speed up PR list and other improvements Jul 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants