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
Linker might run multiple times #55
Comments
No. I think it was always that way, unrelated to GitHub changes. I didn't know it didn't exist, however. I thought it was a race condition that only happened in Firefox, but apparently it isn't. Can you conjure up a fix for this? |
Oh interesting. If I have some time this weekend I'll debug a bit more and see what I come up with. |
So after a bit of investigation, it looks like the js-repo-pjax-container ID is not always added to the Test this for yourself using Normally, this is fine for module linker because you can't navigate directly between files without going to a folder. But I'm using Octotree, which can use some kind of PJAX request from any page. If I go directly to a file, then use Octotree to navigate to another, module-linker links things more than once because the ID is missing. This is pretty easy to fix, by replacing everything selecting I can open a PR if you think this is a good fix! |
I think it is a good idea and you've solved the biggest issue this project has ever faced. Please open a PR. |
It seems that Github does not always add the ID to `main`, but the `main` is always there. Fixes fiatjaf#55
It looks like the 'don't run more than once' protection is broken because Github changed their markup?
This line injects an element to stop the content script from running multiple times but I think it doesn't work because the element it injects into does not exist (or maybe it doesn't always exist).
In this screenshot, notice that there are multiple dots next to the imports, and the
<span id="module-linker-done">
doesn't exist in the page.The text was updated successfully, but these errors were encountered: