Repository navigation
Faster releases-tab on repo home - #6909
Conversation
| const count = pageDetect.isRepoRoot() | ||
| // Always prefer the information in the DOM | ||
| ? await releasesCount.getFresh(repo) | ||
| : await releasesCount.get(repo); |
There was a problem hiding this comment.
I'm done trying to parse the same information from multiple sources. I'll only try it for the default branch. Everything else must go.
parseCountFromDom was silently failing so the tab was loading from the API at every page load on isRepoRoot, slowing the feature down.
|
|
||
| return 0; | ||
| function detachHighlightFromCodeTab(codeTab: HTMLAnchorElement): void { | ||
| codeTab.dataset.selectedLinks = codeTab.dataset.selectedLinks!.replace('repo_releases ', ''); |
There was a problem hiding this comment.
In this case it's relatively easy to have GitHub handle the tab highlight. I looked at bugs-tab as well but it's a bit more complicated:
- we need to target and replace the contents of
<meta name="selected-link" value="repo_issues" data-turbo-transient="">GitHub will then detect this change via MutationObserver.
Pseudo code:
in a MutationObserver
if addedNode.value === repo_issues
addedNode.remove()
addedNode.value = 'repo_bugs'
document.head.append(addedNode)
| window.dispatchEvent(new Event('resize')); | ||
|
|
||
| const dropdownMenu = await elementReady(repoUnderlineNavDropdownUl); | ||
| triggerRepoNavOverflow(); |
releases-tab improvementsreleases-tab on repo home
| /* Only show the divider if there are other items above it */ | ||
| .UnderlineNav-actions [hidden] + .dropdown-divider { | ||
| display: none; | ||
| } |
There was a problem hiding this comment.
This hid the divider when releases-tab was hidden but Security is always there anyway. I don't care to support those who disable more-dropdown-links for this minor inconvenience.
Following #6901 I took a further look at the feature and made some changes. See self-review
It might fix #6293, so I'll close it until I see that bug again.