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

Process loaded code when expanding diff views #453

Closed
xPaw opened this issue Mar 3, 2018 · 7 comments
Closed

Process loaded code when expanding diff views #453

xPaw opened this issue Mar 3, 2018 · 7 comments

Comments

@xPaw
Copy link

xPaw commented Mar 3, 2018

Link: https://github.com/thelounge/thelounge/pull/1839/files#diff-cf27c1d543e886c89cd9ac8b8aeaf05b

Hopefully the GIF explains what I mean:
03-161708105

@josephfrazier
Copy link
Member

This sounds related to #416, since they both concern page changes that don't trigger reprocessing.

@xPaw
Copy link
Author

xPaw commented Mar 4, 2018

I'm not sure that's entirely related, as your linked issue concerns navigation (pjax), while this changes the page state without navigation.

@stefanbuck
Copy link
Member

I agree with @xPaw. This issue is slightly different. It should be relative easy to fix.

We're happy to provide mentor help for people who want to pick this up.

@leomoty
Copy link
Contributor

leomoty commented Aug 27, 2018

Hey @stefanbuck, any pointers for this one?

@stefanbuck
Copy link
Member

At its core, it's just about calling run which will basically re-invoke the whole extension.

async function run(self) {

@leomoty
Copy link
Contributor

leomoty commented Aug 28, 2018

@stefanbuck I have a preliminary version working with MutationObserver, I am looking for addedNodes that contains .blob-expanded, if that is the case, run run again. Should this be a function in octo-linker.js, or something? I can make a PR tomorrow.

@stefanbuck
Copy link
Member

Great news 👍 Yes, putting that into octo-linker.js sounds appropriate to me. Regarding testing, recently I added E2E testing which should make testing such behaviour much easier. Literally, it's just click and inspecting the DOM for new .octolinker-link elements. I'm happy to help you if you get stuck.

stefanbuck pushed a commit that referenced this issue Aug 29, 2018
<!--
  Thanks for filing a pull request!

  Please look at the following checklist to ensure that your PR
  can be accepted quickly:
-->

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:

- [ ] If this PR is a new feature, please provide at least one example link
- [x] Make sure all of the significant new logic is covered by tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants