Skip to content

Only use the default branch to determine repo-age#3445

Merged
fregante merged 5 commits intorefined-github:masterfrom
yakov116:repo-age-api
Aug 10, 2020
Merged

Only use the default branch to determine repo-age#3445
fregante merged 5 commits intorefined-github:masterfrom
yakov116:repo-age-api

Conversation

@yakov116
Copy link
Member

Follows #3340 (comment)

day: 'numeric'
});

const getCommitCount = async (): Promise<AnyObject> => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to extract this into its own function though, especially considering the AnyObject typing. Just merge it back into getFirstCommit

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides that everything else is ok?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember why I split it. I was having issues with constants they both are returning the same names.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what you're talking about

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what happens when I reply half in my sleep. Sorry I misunderstood you I thought you wanted both api requests in one function.

Anyways I'm up now ☕

@fregante fregante changed the title Only use the api for repo-age Only use the default branch to determine repo-age Aug 10, 2020
@fregante fregante added the bug label Aug 10, 2020
@fregante fregante merged commit 275c2f9 into refined-github:master Aug 10, 2020
@fregante
Copy link
Member

fregante commented Aug 10, 2020

Thanks for this fix! Negative diffs are the best Screen Shot 2020-08-10 at 11 26 48

@yakov116 yakov116 deleted the repo-age-api branch August 10, 2020 11:48

// Returning undefined will make sure that it is not cached. It will check again for commits on the next load.
// Reference: https://github.com/fregante/webext-storage-cache/#getter
if (commitsCount === 0) {
Copy link
Member

@fregante fregante Aug 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized that this was removed. Why? It shouldn't be

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since until now the element could have not been ready on time so it would be undefined. Now the only case would be on a brand new repo.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the only case would be on a brand new repo.

Yes. Brand new repos still exist and now I think this would throw in those cases because repository.defaultBranchRef.target is null

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The easiest way is to add isEmptyRepoRoot to excludes

TODO lint <-- search this next week :D

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol

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

Labels

Development

Successfully merging this pull request may close these issues.

2 participants