-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Add a store for cloneable repositories #6278
Conversation
Or else nothing is gonna work
Are there some release notes related to #5937 that we could/should include here? Maybe something like: [Improved] Maintains state on tabs for different methods of cloning repositories Thoughts? |
@iAmWillShepherd Sorry for the post-review update but I found a race condition that I had missed when the accounts store was updating at the same time as the apiRepositoriesStore was so I decided it was better to fix it now before this PR lands. |
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 good. Appreciate your documentation is so clear and concise 👍
Ready for one last lookie-loo! |
Shifting this to 1.5.1 per our team sync today. |
Overview
As part of the onboarding work I'm doing in #5686 I'm going to need access to the list of "cloneable" repositories in the blank slate. Currently the logic for fetching repositories available to the user from the API is contained within the clone dialog itself. This PR extracts that logic into a separate store responsible for loading and refreshing the list of repositories.
The improvements in this PR made the disadvantages of our current shared state model all the more noticeable (you couldn't switch between tabs and maintain selection) so I took the opportunity to remove the shared state n favor of per-tab as users would expect (see #5937). Each tab now maintains its own selection, filter text, path, etc.
Closes #5937 by maintaining separate state for each of the tabs in the clone dialog.
Description
Additional benefits of this change
Memoization
This PR introduces a memoization pattern that we haven't used before in the app which I think could use some further explanation. See the react blog for a good write-up but basically I've made the
CloneGithubRepository
component pure and stateless and used memoization to ensure that we only recompute the filter list groups when necessary.Release notes
[Improved] Clone dialog remembers selections, filter text, and path in each tab
[Improved] The list of repositories in the clone dialog are no longer loaded from the API every time the dialog is opened or when the selected tab changes.
TODO
Automatically refresh the repository list when some amount of time has elapsed since last time?See if we can't get rid of the null state for repositories in theCloneGitHubRepository
component