Skip to content

cleanup-repo-filelist-actions: Cannot read property 'replaceWith' of null #3963

Closed

Description

@orrc

Refined GitHub version: 21.2.9
Chrome version: 88.0.4324.96 (macOS, x86_64)
GitHub version: GitHub Enterprise Server 2.22.3

❌ Refined GitHub → cleanup-repo-filelist-actions → TypeError: Cannot read property 'replaceWith' of null
    at init (VM37 refined-github.js:7589)
    at runFeature (VM37 refined-github.js:2091)
    at setupPageLoad (VM37 refined-github.js:2099)
    at VM37 refined-github.js:2132 

I can reproduce this on any repo main page on GitHub Enterprise, but not on GitHub.com, so I unfortunately can't provide a URL.

However, looking at the cleanup-repo-filelist-actions code, I think the problem might be that the "Add file" span itself has the btn class (rather than a parent tag).

Here's a diff of document.querySelector('.btn[data-hotkey="t"]').nextElementSibling from GitHub.com → GHE:

$ diff -uw add-file_github-dot-com.html add-file_ghe.html

--- add-file_github-dot-com.html        2021-02-10 12:11:23.000000000 +0100
+++ add-file_ghe.html   2021-02-10 12:12:14.000000000 +0100
@@ -1,19 +1,18 @@
 <details class="details-overlay details-reset position-relative d-block">
-    <summary role="button" type="button" class="btn ml-2">
-        <span class="d-none d-md-flex flex-items-center">
+    <summary role="button">
+        <span class="ml-2 btn d-none d-md-flex flex-items-center">
             Add file
             <span class="dropdown-caret ml-1"></span>
         </span>
-        <span class="d-inline-block d-md-none">
+        <span class="ml-2 btn d-inline-block d-md-none">
             <svg aria-label="More options" class="octicon octicon-kebab-horizontal" height="16" viewBox="0 0 16 16" version="1.1" width="16" role="img">
                 <path d="M8 9a1.5 1.5 0 100-3 1.5 1.5 0 000 3zM1.5 9a1.5 1.5 0 100-3 1.5 1.5 0 000 3zm13 0a1.5 1.5 0 100-3 1.5 1.5 0 000 3z"></path>
             </svg>
         </span>
     </summary>
-    <div>
         <ul class="dropdown-menu dropdown-menu-sw">
             <li class="d-block d-md-none">
-                <a class="dropdown-item" data-hydro-click="…" data-hydro-click-hmac="…" data-ga-click="…" data-hotkey="t" data-pjax="true" href="/org-name/repo-name/find/master">
+            <a class="dropdown-item" data-ga-click="…" data-hotkey="t" data-pjax="true" href="/org-name/repo-name/find/master">
                     Go to file
                 </a>
             </li>
@@ -33,5 +32,4 @@
                 </a>
             </li>
         </ul>
-    </div>
 </details>

Activity

  1. added
    enterprise
    on Feb 10, 2021
  2. fregante commented on Feb 14, 2021

    @fregante
    Member

    Is this related to #3685? #3531 could fix both, if someone picks it up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedbugenterprise

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions