Skip to content

Stream repositories available to the user from the API - #16286

Merged
niik merged 16 commits into
developmentfrom
stream-available-repos
Mar 28, 2023
Merged

niik merged 16 commits into
developmentfrom
stream-available-repos

Conversation

@niik

@niik niik commented Mar 9, 2023

Copy link
Copy Markdown
Member

Closes #16276
Closes #8955
Closes #2770

Description

Improved the user experience in the clone repositories dialog for users with access to lots and lots of repositories.

Prior to this change we waited until we had loaded all repositories from the /user/repos endpoint (could be hundreds of pages long for some users) before we showed them in the UI. With this PR I'm intending to improve that experience for users with tons of repos while not making it any worse for the vast majority of users who have access to very few repositories.

The way I went about this was by showing the repositories in the UI as each page from the API is coming in and by making multiple concurrent streaming requests in order to prioritize the users own repositories over repositories for organizations that they belong to (which is typically but not always the culprit).

Prior to this change it took me almost 5 minutes of waiting on the clone repository dialog before I could see any repositories and after this it's a matter of seconds until I at least see my own repositories. The overall load time is also improved some by us loading owner, collaborator, and org affiliated repositories in three different concurrent streams.

Beyond those changes I noticed that we count any repository not owned by an organization as being "Your repository" in the filter list, that's been fixed to only include repository actually owned by the user. Additionally I've made it so that refreshing the list of repositories doesn't throw away all the repositories we've got access to.

Possible further improvements

I think an additional improvement that could be useful here is to add another fetch when refreshing repositories that only grab repositories created after the last fetch (i.e. MAX(existing_repositories::created_at)). That would let users who've just created a repository online be able to see it almost instantaneously after hitting refresh.

Showing a message when the user is searching but not finding what they're looking for would be nice (we're still loading repositories, your search results may be incomplete).

We could/should consider redesigning the clone screen to only show the users owned repositories by default. Ideally we'd let the user pick which org to load but the API support for that doesn't exists AFAICT.

For users with tons of repos there's a lot of overhead data from the API here that we don't care about. From a bandwidth conservation perspective GraphQL could help here.

Screenshots

Release notes

Notes:

sergiou87
sergiou87 previously approved these changes Mar 17, 2023

@sergiou87 sergiou87 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code makes sense and works great!!! ⚡

I only found one comment line that isn't needed anymore. I'll approve the PR anyway and leave it up to you whether you remove it here or not.

Comment thread app/src/lib/api.ts Resolved
Co-authored-by: Sergio Padrino <[email protected]>
@niik

niik commented Mar 28, 2023

Copy link
Copy Markdown
Member Author

Gentle reminder here @sergiou87, I think this is all reviewed, I just applied that suggestion of yours to remove the comment

@sergiou87 sergiou87 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yup! Sorry, I forgot about that 😳

@niik
niik merged commit a6f5740 into development Mar 28, 2023
@niik
niik deleted the stream-available-repos branch March 28, 2023 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants