@@ -38,7 +38,7 @@ export default defineComponent({
3838    return  { 
3939      tab , 
4040      repos: [], 
41-       reposTotalCount: 0 , 
41+       reposTotalCount: null , 
4242      reposFilter , 
4343      archivedFilter , 
4444      privateFilter , 
@@ -112,9 +112,6 @@ export default defineComponent({
112112    const   el =  document .querySelector (' #dashboard-repo-list'  ); 
113113    this .changeReposFilter (this .reposFilter ); 
114114    fomanticQuery (el .querySelector (' .ui.dropdown'  )).dropdown (); 
115-     nextTick (() =>  { 
116-       this .$refs .search ?.focus (); 
117-     }); 
118115
119116    this .textArchivedFilterTitles  =  { 
120117      ' archived'  : this .textShowOnlyArchived , 
@@ -242,12 +239,20 @@ export default defineComponent({
242239
243240      let  response, json; 
244241      try  { 
242+         const   firstLoad =  this .reposTotalCount  ===  null ; 
245243        if  (! this .reposTotalCount ) { 
246244          const   totalCountSearchURL =  ` ${this .subUrl }/repo/search?count_only=1&uid=${this .uid }&team_id=${this .teamId }&q=&page=1&mode= ` ; 
247245          response  =  await  GET (totalCountSearchURL ); 
248246          this .reposTotalCount  =  parseInt (response .headers .get (' X-Total-Count'  ) ??  ' 0'  ); 
249247        } 
250- 
248+         if  (firstLoad  &&  this .reposTotalCount ) { 
249+           nextTick (() =>  { 
250+             //  MDN: If there's no focused element, this is the Document.body or Document.documentElement. 
251+             if  ((document .activeElement  ===  document .body  ||  document .activeElement  ===  document .documentElement )) { 
252+               this .$refs .search .focus ({preventScroll: true }); 
253+             } 
254+           }); 
255+         } 
251256        response  =  await  GET (searchedURL ); 
252257        json  =  await  response .json (); 
253258      } catch  { 
@@ -349,7 +354,7 @@ export default defineComponent({
349354      <h4  class =" ui top attached header tw-flex tw-items-center"  >
350355        <div  class =" tw-flex-1 tw-flex tw-items-center"  >
351356          {{ textMyRepos }}
352-           <span  class =" ui grey label tw-ml-2"  >{{ reposTotalCount }}</span >
357+           <span  v-if = " reposTotalCount "   class =" ui grey label tw-ml-2"  >{{ reposTotalCount }}</span >
353358        </div >
354359        <a  class =" tw-flex tw-items-center muted"   :href =" subUrl + '/repo/create' + (isOrganization ? '?org=' + organizationId : '')"   :data-tooltip-content =" textNewRepo"  >
355360          <svg-icon  name =" octicon-plus"  />
@@ -420,7 +425,7 @@ export default defineComponent({
420425      </div >
421426      <div  v-if =" repos.length"   class =" ui attached table segment tw-rounded-b"  >
422427        <ul  class =" repo-owner-name-list"  >
423-           <li  class =" tw-flex tw-items-center tw-py-2"   v-for =" repo, index in repos"   :class =" {'active': index === activeIndex}"   :key =" repo.id"  >
428+           <li  class =" tw-flex tw-items-center tw-py-2"   v-for =" ( repo, index)  in repos"   :class =" {'active': index === activeIndex}"   :key =" repo.id"  >
424429            <a  class =" repo-list-link muted"   :href =" repo.link"  >
425430              <svg-icon  :name =" repoIcon(repo)"   :size =" 16"   class =" repo-list-icon"  />
426431              <div  class =" text truncate"  >{{ repo.full_name }}</div >
0 commit comments