Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlighting does not work on large PRs #28

Closed
aidando73 opened this issue Oct 11, 2022 · 1 comment · Fixed by #41
Closed

Highlighting does not work on large PRs #28

aidando73 opened this issue Oct 11, 2022 · 1 comment · Fixed by #41
Labels
bug Something isn't working critical

Comments

@aidando73
Copy link
Owner

image

@aidando73 aidando73 added bug Something isn't working critical labels Oct 11, 2022
@aidando73
Copy link
Owner Author

aidando73 commented Oct 28, 2022

MutationObserver does not fire on file-content (on childList and subtree - probably due to how the shadow dom works).

But it does fire on attributes (on aria-label)

const allDiffsObserver = new MutationObserver((mutations) => {
  mutations
    .forEach(mutation => {
      if (mutation.type === 'attributes' && mutation.attributeName === 'aria-label') {
        highlightDiffFile(mutation.target);
      }
    });
});

E.g., the above mostly works. This works with both the arrows and individual files (but doesn't when a picture is previous photo).

One solution is to check whether the PR is a large one (e.g. search for "This is a large PR.") and then behave differently.

This also could be the more maintainable approach as the two styles behave quite differently and it'd be easier to find solutions when they're separate instead of bundled into one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working critical
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant