Skip to content

update-pr-from-base-branch sometimes duplicates native functionality #5586

Closed

Description

@fregante

Description

GitHub offers the same functionality in two cases:

Since the mergeability box is slower than our feature, I'd rather not have to wait for it, but we can improve the situation:

  • on click, if a "Resolve conflict" is present and is clickable, we should .click() it instead of using the API. This is a must because our API call just throws an error anyway:
    Screen Shot 12
  • if at any time we encounter a "Update branch" button, we should "forever" disable the feature on the current repo. This can be done on a "best effort" basis, for example we can check:
    • on load, if the mergeability box ever happens to load before us
    • on click (either on our link or their button)
      It can be a simple void isExistenceMeaningful() call in both cases that calls cache.set for the next page load (we do this for the hotfix as well)

Screenshot

Screen Shot 11

Side note: here the button is disabled, so we can ignore it, we can't do it better.

Example URL

refined-github/sandbox#9

Activity

  1. self-assigned this
    on Apr 11, 2022
  2. removed their assignment
    on Apr 11, 2022
  3. fregante commented on Apr 11, 2022

    @fregante
    MemberAuthor

    We already have a check for the button, but that is also in "best effort"

    // "Resolve conflicts" is the native button to update the PR
    if (select.exists('.js-merge-pr a[href$="/conflicts"]')) {
    return false;
    }

    Is it possible to detect conflicts via this API call? Ideally we should not show it at all in that case:

    const {status} = await api.v3(`compare/${base}...${head}`);

    As an unrelated and simpler change, I'd also use our toast to show the progress and error here.

  4. added
    small
    and removed on Jun 4, 2022
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

    acceptedenhancementsmall

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions