sindresorhus/refined-github

⚠️ Many features don't work until you refresh the page #4695

fregante posted onGitHub

Please ensure:

  • The bug is caused by Refined GitHub. It doesn't happen if I disable the extension.

Description

One of the recent AJAX PRs might have broken the loader altogether. One example I see is in the PR Files tab.

  1. Open https://github.com/sindresorhus/refined-github/pull/4685
  2. Click the files tab
  3. Notice that almost every feature is missing:
  • remove-diff-signs
  • pr-jump-to-first-non-viewed-file
  • faster-reviews
  • collapsible-button (but table-input is working, these 2 should be identical)
  • batch-mark-files-as-viewed
  • etc etc etc
  1. Refresh the page, everything works

cc @kidonng @dertieran @cheap-glitch @yakov116 as you've recently worked on the ajax part

Screenshot

<img width="225" alt="Screen Shot 2" src="https://user-images.githubusercontent.com/1402241/130322058-16b2cd94-7339-4b0b-8397-daac71b5a394.png">

Console errors

No response

Example URL

https://github.com/sindresorhus/refined-github/pull/4685 -> then click the files tab

Browser(s) used

Safari


Seeing this as well.

Trying to run bisect to find the issue doesn't work, https://github.com/sindresorhus/refined-github/blob/d8cadc830723728ab5c32f36cea31ea3f6aee814/source/helpers/bisect.tsx#L54 document.body is somehow null.

highlight-deleted-and-added-files-in-diffs is breaking due to https://github.com/sindresorhus/refined-github/blob/d8cadc830723728ab5c32f36cea31ea3f6aee814/source/features/highlight-deleted-and-added-files-in-diffs.tsx#L43 trying to call cloneNode on undefined.

Sometimes refreshing the page can get it to work. May try to look into this sometime this week as I'm really missing these features.

posted by williammck over 3 years ago

Dug around for a bit, this is due to deduplicate not being set to has-rgh-inner on some features after https://github.com/sindresorhus/refined-github/pull/4571.

e.g. if I apply the following patch, faster-reviews now starts functioning properly even after multiple tab clicks.

diff --git a/source/features/faster-reviews.tsx b/source/features/faster-reviews.tsx
index 1b11bd54..7cc4e23c 100644
--- a/source/features/faster-reviews.tsx
+++ b/source/features/faster-reviews.tsx
@@ -54,6 +54,7 @@ void features.add(__filebasename, {
                },
        ],
        awaitDomReady: false,
+       deduplicate: 'has-rgh-inner',
        init: addSidebarReviewButton,
 }, {
        shortcuts: {
@@ -63,5 +64,6 @@ void features.add(__filebasename, {
                pageDetect.isPRFiles,
        ],
        awaitDomReady: false,
+       deduplicate: 'has-rgh-inner',
        init: initReviewButtonEnhancements,
 });

I may spend some time this weekend identifying where all this needs to be updated, if no one gets to it before then.

posted by williammck over 3 years ago

Thank you! It's possible that they just changed the container for PRs so it broke it for every PR feature.


It'd be great to create a map of "page:deduplicate-selector" so that this can be handled by the feature manager instead of having to manually specify it in every feature, but this might take a little effort. It's best to focus on patching the specific features first so we can release a fix soon.

Anyway this is what I mean:

``` js const deduplicateMap = { isPR: '.has-rgh-inner', isDashboard: '.has-rgh', }

posted by fregante over 3 years ago

@williammck would you be able to send a PR?

posted by fregante over 3 years ago

This has been fixed for many PR-related features and will be in the upcoming v21.10.1.

If you still see this problem after updating, please leave a link to the page you're seeing the issue on (i.e. the page you have to refresh for features to appear)

posted by fregante over 3 years ago

Fund this Issue

$0.00
Funded

Pull requests