File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -57,10 +57,22 @@ function initCloneSchemeUrlSelection(parent: Element) {
5757 const tabSsh = parent . querySelector ( '.repo-clone-ssh' ) ;
5858 const tabTea = parent . querySelector ( '.repo-clone-tea' ) ;
5959 const updateClonePanelUi = function ( ) {
60- const scheme = localStorage . getItem ( 'repo-clone-protocol' ) || 'https' ;
61- const isHttps = scheme === 'https' && Boolean ( tabHttps ) || scheme !== 'https' && ! tabHttps ;
62- const isSsh = scheme === 'ssh' && Boolean ( tabSsh ) || scheme !== 'ssh' && ! tabSsh ;
63- const isTea = scheme === 'tea' && Boolean ( tabTea ) || scheme !== 'tea' && ! tabTea ;
60+ let scheme = localStorage . getItem ( 'repo-clone-protocol' ) || 'https' ;
61+
62+ // Fallbacks if the scheme preference is not available in the tabs.
63+ if ( scheme === 'tea' && ! tabTea ) {
64+ scheme = 'https' ;
65+ }
66+ if ( scheme === 'https' && ! tabHttps ) {
67+ scheme = 'ssh' ;
68+ } else if ( scheme === 'ssh' && ! tabSsh ) {
69+ scheme = 'https' ;
70+ }
71+
72+ const isHttps = scheme === 'https' ;
73+ const isSsh = scheme === 'ssh' ;
74+ const isTea = scheme === 'tea' ;
75+
6476 if ( tabHttps ) {
6577 tabHttps . textContent = window . origin . split ( ':' ) [ 0 ] . toUpperCase ( ) ; // show "HTTP" or "HTTPS"
6678 tabHttps . classList . toggle ( 'active' , isHttps ) ;
You can’t perform that action at this time.
0 commit comments