Use first commit for repo age#2667
Use first commit for repo age#2667hardikmodha wants to merge 22 commits intorefined-github:masterfrom
Conversation
a52da6a to
b486593
Compare
fregante
left a comment
There was a problem hiding this comment.
Looks great!
Just a thought for now, but perhaps it would be nice to also link to that first commit since we have the information on the same page and every piece in the summary is also a link.
|
@fregante should we fall back to the old way if there are no commits? |
I don't think anybody cares about repos without commits 😄 At most we can prevent the error by using |
|
I think just returning makes sense, saves us an unnecessary request. |
98c5a62 to
e06ffd5
Compare
Makes sense. Each and every item is a link in summary we can do that. |
|
@fregante I have incorporated the changes to point to the oldest commit in the |
|
@hardikmodha looks great. One thing with this change there is a noticeable jump on every load. |
|
@yakov116 Yes, I noticed that as well. I'm working on adding some sort of loader icon as we discussed. |
|
No need to get fancy with loaders. The user timezone feature just uses a static |
I think it’s nicer to handle that now and drop the code later rather than add extra text to our clear key name 😁 |
❌ repo-age
content.js:3474 RangeError: Invalid time value
at repo_age_init (content.js:9396)
at async features_run (content.js:3469) |
7a61131 to
e631a12
Compare
|
@yakov116 I was not handling the existing cached values previously. Now, I am. Can you check again? |
|
@hardikmodha nope try |
|
@yakov116 It's working for me. Are you sure on the latest commit? |
|
Yup |
|
@hardikmodha I also noticed it will fail on any link that the path has |
|
If this is starting to look like a lot of moving parts, you can also split the PR into 2 pieces:
|
1. Do not wait for DOM for fetching commit details. 2. Remove unnecessary function 3. Edit content of repo-age item on summary row
40f0850 to
6a399ba
Compare
| return false; | ||
| } | ||
|
|
||
| if (commitsCount === 1) { |
There was a problem hiding this comment.
I think repos with a single commit are rare enough that we can drop this condition.
There was a problem hiding this comment.
Then, What do we display for 1 commit repo?
There was a problem hiding this comment.
Without this condition, it will just continue like it would with more commits, to fetchDom etc.
There was a problem hiding this comment.
But the request would not return anything, the page returned by fetchDom would be empty and we won't find any commits there....
There was a problem hiding this comment.
Ouch. Didn’t think it would be. I guess it can stay then.
|
Hardik can you split this into multiple PRs as suggested before? #2667 (comment) The first 2 PRs should be pretty straightforward and can be merged quickly. The 3rd apparently is taking a while to discuss |
Closes #2660
Using the latest commit available on the repo root and the total number of commits to fetch the oldest commit.
Test