File tree Expand file tree Collapse file tree
app/src/ui/repositories-list Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,9 +27,17 @@ import { SectionFilterList } from '../lib/section-filter-list'
2727import { assertNever } from '../../lib/fatal-error'
2828import { IAheadBehind } from '../../models/branch'
2929import { ShowBranchNameInRepoListSetting } from '../../models/show-branch-name-in-repo-list'
30+ import { throttle } from 'lodash'
3031
3132const BlankSlateImage = encodePathAsUrl ( __dirname , 'static/empty-no-repo.svg' )
3233
34+ const refreshRepositoryThrottled = throttle (
35+ async ( dispatcher : Dispatcher , repository : Repository ) => {
36+ await dispatcher . refreshRepository ( repository )
37+ } ,
38+ 5000
39+ )
40+
3341interface IRepositoriesListProps {
3442 readonly selectedRepository : Repositoryish | null
3543 readonly repositories : ReadonlyArray < Repositoryish >
@@ -180,7 +188,7 @@ export class RepositoriesList extends React.Component<
180188 item . repository
181189 )
182190 if ( branchState . allBranches . length === 0 ) {
183- this . props . dispatcher . refreshRepository ( item . repository )
191+ refreshRepositoryThrottled ( this . props . dispatcher , item . repository )
184192 return false
185193 }
186194 const defaultBranch = branchState . defaultBranch
You can’t perform that action at this time.
0 commit comments