Repository navigation
Load more timeline items when clicking a link to an unloaded comment - #393
Merged
Merged
Conversation
inimaga
approved these changes
Oct 7, 2026
inimaga
approved these changes
Oct 7, 2026
Contributor
|
🚀 Released in version 1.5.70 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On long issues and PRs, GitHub collapses the middle of the timeline behind a "N remaining items / Load more" control. Clicking a link to a comment on the same page (eg.
#issuecomment-123orhttps://github.com/org/repo/pull/1#discussion_r456) does nothing when that comment is inside the collapsed section, because the target isn't in the DOM yet.Solution
Add
loadMoreUntilAnchor, initialized on the issue and PR pages. It listens for plain left-clicks on links whose URL points at the current issue/PR path with a hash. If the target element (or itsuser-content-markdown heading variant) isn't in the DOM, it polls every 250ms:button[data-testid^="issue-timeline-load-more-"],button[data-testid="hidden-items-expander"]andbutton.ajax-pagination-btn, skipping ones that are disabled or havedata-loading="true".It stops after 30 seconds, after 3 seconds with no load-more control left, or when the user scrolls or presses a key. It runs independently of the auto load more comments preference.
Fixed Issues
None
Tests
npm run lintand confirm no errors.npm run buildand loaddistas an unpacked extension.