question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`default-branch-button` does not work with long branch names that are truncated in the UI

See original GitHub issue

Please ensure:

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

Include in this issue:

  • Screenshots/video/gif demonstrating the bug, if it’s visual
  • Console errors, if any

Description

The Problem

Press the default-branch-button in the example url, and it will redirect you to https://github.com/gamemaker1/express-rate-limit/commits/opiniated-impr.... This is because the branch name is truncated in the #branch-select-menu div.

Possible Fix

Change the selector in the getDefaultBranch helper function that retrieves the branch name from the UI:

https://github.com/refined-github/refined-github/blob/main/source/github-helpers/get-default-branch.ts#L26

From:

select('#branch-select-menu [data-menu-button]');

To:

select('#branch-select-menu [data-menu-button]:not(.css-truncate-target)');

So that it makes an API call and gets the default branch instead of using the truncated name from the UI (an alternative would be getting the branch from somewhere else in the DOM).

Not tested, but I think this should work.

Example URL

https://github.com/gamemaker1/test/tree/very-very-long-long-long-long-branch-name

Browser(s) used

Firefox

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
kidonngcommented, Dec 29, 2021

I think this is already fixed in the associated PR.

1reaction
fregantecommented, Dec 29, 2021

That’s why it happened. We have a few ways to figure out the default branch and one of them might be reading the truncated value somewhere.

To fix this, we just need to verify all of these ways

Read more comments on GitHub >

github_iconTop Results From Across the Web

Regression in 8.7 with merge request UI - long branch names are ...
With the upgrade to 8.7, the UI is no longer usable in this case since the branch names get truncated. With 8.6 they...
Read more >
sluggify and/or truncate branch names to reduce branchName ...
I've transferred this issue into the main Renovate repo and labeled it as a feature request. As you've kind of identified, using more...
Read more >
Keep Git Branch Name Untruncated in Shell using p10k (Oh ...
p10k.zs file to turn off git branch name truncating. I've already tried many combinations, including Google searches, and nothing worked.
Read more >
How can we increase the branch-name maxlength parameter?
When I create a branch from a Jira issue, there is a 50 characters limitation on branch-name field. Our issues summary fields are...
Read more >
Let the branch name do all the talking in git - codeburst
I like and use BEM for CSS, it clearly says all about the code and saves time for developers. And I badly wanted...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found