Wait for gutter cells to render before rendering jump to next uncovered line button#38
Open
dejan-lukic wants to merge 1 commit intoqltysh:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors UI injection to await coverage rendering before adding the “Jump to next uncovered line” button and updates the navigation logic to properly deselect and reselect coverage lines when navigating.
- Converted
tryInjectDiffCommitUItoasyncand extracted link processing intoprocessFileLinks - Added logic in
jumpToNextUncoveredLineto deselect the current line before moving and reselect the new line - Introduced a
selectLinkableLinehelper and updated badges/buttons injection timing
Comments suppressed due to low confidence (3)
src/github-injector.ts:180
- The new deselection and reselection logic in
jumpToNextUncoveredLineisn’t covered by tests. Consider adding unit tests to verify that the current line is deselected and the new line is highlighted correctly.
const currentElement = uncoveredLineDivs[currentlySelectedIndex];
src/github-injector.ts:82
- The early return checking for
qlty-diff-uiwas removed, sotryInjectDiffCommitUImay inject badges and buttons multiple times. Consider re-adding a guard likeif (rootElement.classList.contains('qlty-diff-ui')) return;at the top.
async function tryInjectDiffCommitUI(): Promise<void> {
src/github-injector.ts:107
- [nitpick] The
rootElementparameter is never used insideprocessFileLinks. Removing this unused parameter will simplify the function signature.
async function processFileLinks(rootElement: HTMLElement, links: Element[]) {
0493721 to
08e6d9d
Compare
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.
The button does not get rendered if there are no missed coverage lines, so we wait for the coverage data to load and the cells to be rendered before attempting a render of the button