Skip to content

Console errors in PR-related features #5547

Closed

Description

@cheap-glitch

Please ensure:

  • The bug is caused by Refined GitHub. It doesn't happen if I disable the extension.
  • The bug happens after clearing extension cache. The "Clear cache" button below can also be found at the bottom of the options page.

Example URLs

refined-github/sandbox#4

Extension version

22.3.18

Browser(s) used

Firefox

Description

  1. Go to an open PR (e.g. https://togithub.com/refined-github/sandbox/pull/4)
  2. Open the merging box
  3. Click cancel
  4. Reload the page, sit back, and enjoy the console errors:
❌ clear-pr-merge-commit-message refined-github.js:3007:17
📕 22.3.18 → TypeError: messageField is undefined
    init moz-extension://6ffeab5e-837d-450e-9fa5-fe3ec6a7ee9f/refined-github.js:8622
    runFeature moz-extension://6ffeab5e-837d-450e-9fa5-fe3ec6a7ee9f/refined-github.js:3044
    sessionResumeHandler moz-extension://6ffeab5e-837d-450e-9fa5-fe3ec6a7ee9f/refined-github.js:6003
refined-github.js:3007:43

❌ suggest-commit-title-limit refined-github.js:3007:17
📕 22.3.18 → TypeError: inputField is undefined
    validateInput moz-extension://6ffeab5e-837d-450e-9fa5-fe3ec6a7ee9f/refined-github.js:7481
    runFeature moz-extension://6ffeab5e-837d-450e-9fa5-fe3ec6a7ee9f/refined-github.js:3044
    sessionResumeHandler moz-extension://6ffeab5e-837d-450e-9fa5-fe3ec6a7ee9f/refined-github.js:6003
refined-github.js:3007:43

TypeError: textarea is undefined refined-github.js:6921:7

❌ clear-pr-merge-commit-message refined-github.js:3007:17
📕 22.3.18 → TypeError: messageField is undefined
    init moz-extension://6ffeab5e-837d-450e-9fa5-fe3ec6a7ee9f/refined-github.js:8622
    runFeature moz-extension://6ffeab5e-837d-450e-9fa5-fe3ec6a7ee9f/refined-github.js:3044
    sessionResumeHandler moz-extension://6ffeab5e-837d-450e-9fa5-fe3ec6a7ee9f/refined-github.js:6003
refined-github.js:3007:43

❌ suggest-commit-title-limit refined-github.js:3007:17
📕 22.3.18 → TypeError: inputField is undefined
    validateInput moz-extension://6ffeab5e-837d-450e-9fa5-fe3ec6a7ee9f/refined-github.js:7481
    runFeature moz-extension://6ffeab5e-837d-450e-9fa5-fe3ec6a7ee9f/refined-github.js:3044
    sessionResumeHandler moz-extension://6ffeab5e-837d-450e-9fa5-fe3ec6a7ee9f/refined-github.js:6003
refined-github.js:3007:43

TypeError: textarea is undefined refined-github.js:6921:7

The culprit:

document.addEventListener('session:resume', sessionResumeHandler(callback));

Not only is this event fired several times during the reloading of the page, but most of those times are before the merge box is even loaded.

I suggest dropping this and renaming the listener onPrMergePanelToggle (because it's triggered every time the merge panel is opened, not just the first).

If we really need to react to the initial load of the merge box, we can listen to its include-fragment instead.

Include in this issue:

  • Screenshots/video/gif demonstrating the bug, if it’s visual
  • Console errors, if any
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions