Refined-github: `GetCurrentBranch` Stopped working on issues

Created on 12 Oct 2020  Âˇ  14Comments  Âˇ  Source: sindresorhus/refined-github

This is a major problem

Test on https://github.com/sindresorhus/refined-github/issues/3638 or even this issue.

bug help wanted

All 14 comments

???

There's no branch on issues.

But the more-dropdown...

Then the more dropdown… stopped working 😉 not the function itself

We should either ensure that more-dropdown doesn’t call the function where it doesn’t make sense, or that the function returns undefined when it doesn’t find the expected URL format

I think https://github.com/sindresorhus/refined-github/blob/d7d700a20befb552f9f64e15504b845dbe04e699/source/github-helpers/get-default-branch.ts can be used if getCurrentBranch() fails (combined with returning undefined if it can not find expected URL?

const reference = getCurrentBranch() || getDefaultBranch();

OR... should it be the other way, getCurrentBranch() returning getDefaultBranch() as a fallback?

getCurrentBranch() returning getDefaultBranch() as a fallback?

☝️

I think getCurrentBranch does not make sense outside of code pages, it’s best to make it explicit like in your first example, only where necessary.

On this issue:

$('[type="application/atom+xml"]').href
// -> "https://github.com/sindresorhus/refined-github/commits/master.atom"

So what's the error? It exists and it's already the default branch

$('[type="application/atom+xml"]').href
// Uncaught TypeError: Cannot read property 'href' of null

not for me

$('[type="application/atom+xml"]').href
// Uncaught TypeError: $(...) is null

Me neither (on Firefox)

I think I encountered the same issue that caused https://github.com/sindresorhus/refined-github/issues/2799 (i.e. GitHub doesn't cleanup the links after AJAX navigation)

I think we should send a ticket into github. We really depend on it, (the whole GithubURL will not work). I hope they are not removing it.

This is not a bug. Issues don’t have a branch.

GitHubURL should not depend on it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mareksuscak picture mareksuscak  Âˇ  3Comments

hkdobrev picture hkdobrev  Âˇ  3Comments

hkdobrev picture hkdobrev  Âˇ  3Comments

pawelad picture pawelad  Âˇ  3Comments

fregante picture fregante  Âˇ  3Comments