-
-
Notifications
You must be signed in to change notification settings - Fork 277
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
Rerun Octo-Linker when blobs are expanded #505
Conversation
@stefanbuck I noticed the same |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks almost perfect 😉I would just narrow down the mutation observer and simplify the e2e test a little bit
packages/core/octo-linker.js
Outdated
observer.observe(document.body, { | ||
childList: true, | ||
subtree: true, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is really an issue, but I think we should narrow down this observe a little bit to avoid potential side effects / performance issues.
for (const el of document.querySelectorAll('.diff-table tbody')) {
observerElement(el);
}
I think, by observing diff-table tbody
you can also get rid of subtree: true
since the mutation happens on that element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, I wanted to get an early review, didn't think about the performance implications
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea to get feedback early one 👍
e2e/automated.test.js
Outdated
|
||
await page.waitForSelector(selector); | ||
|
||
await Promise.all([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's enough to check if OctoLinker insert new links into the dom without actually clicking them. Therefore I would suggest to remove everything between line 87-92.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, i'll update it.
Yeah, I noticed that same that e2e tests related to diff view are a bit flaky. I will disable them until I found the root cause. |
Regarding your issue with |
I can't realistically make
If you want I can open an issue regarding those. |
Ohhh, haven't seen |
I think I was able to fix the e2e test issue by using eslint rather than wepack #506. |
@stefanbuck they might lower the barrier a little bit, I cant state the usefulness of |
@stefanbuck squashed & force pushed with the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I have one last question regarding MutationObserver
. I can also have look by myself tomorrow. Apart from that LGTM.
packages/core/octo-linker.js
Outdated
const observer = new MutationObserver(mutations => { | ||
mutations.forEach(mutation => { | ||
const nodes = Array.from(mutation.addedNodes); | ||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure that this condition is still needed? I think run
can be invoked anytime when a mutation is triggered (assume only one mutation is happing when clicking the expand button).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll confirm, missed that when you talked about restricting the mutation target.
If you could open an issue for the |
@stefanbuck Updated again, also yes, just running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works like a charm. Thanks again for addressing this feature request.
Sorry, took me a bit longer than usually to release a new version. However it's on the way and thanks again for adding this cool feature |
Hey @stefanbuck, no problem, had some water damage at my house, i'll take a look at #510 this week. |
Oh no what a nightmare. #510 is not that critical so no need to rushing it. Good luck with fix your water issue. |
It is fixed by now, no hardware died. |
This is a possible implementation for #453, we observe the DOM, if any new
.blob-expanded
nodes are added, then the extension is rerun.As far as testing goes, I will wait for feedback, I added a single test that clickes the specific
.js-expand
element and then tries to process a single line from it.Checklist: