Skip to content

Use first commit for repo age - #2667

Closed
hardikmodha wants to merge 22 commits into
refined-github:masterfrom
hardikmodha:use_first_commit_for_repo_age
Closed

hardikmodha wants to merge 22 commits into
refined-github:masterfrom
hardikmodha:use_first_commit_for_repo_age

Conversation

@hardikmodha

Copy link
Copy Markdown
Contributor

@hardikmodha
hardikmodha force-pushed the use_first_commit_for_repo_age branch from a52da6a to b486593 Compare January 5, 2020 17:04

@fregante fregante left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Comment thread source/features/repo-age.tsx Resolved
Comment thread source/features/repo-age.tsx Resolved
Comment thread source/features/repo-age.tsx Resolved
Comment thread source/features/repo-age.tsx Resolved
Comment thread source/features/repo-age.tsx Resolved
@yakov116

yakov116 commented Jan 5, 2020

Copy link
Copy Markdown
Member

@fregante should we fall back to the old way if there are no commits?

@fregante

fregante commented Jan 5, 2020

Copy link
Copy Markdown
Member

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 if count === 0, return false

@hardikmodha

Copy link
Copy Markdown
Contributor Author

I think just returning makes sense, saves us an unnecessary request.

@hardikmodha
hardikmodha force-pushed the use_first_commit_for_repo_age branch from 98c5a62 to e06ffd5 Compare January 5, 2020 17:55
@hardikmodha
hardikmodha marked this pull request as ready for review January 5, 2020 17:59
@hardikmodha
hardikmodha requested a review from fregante January 5, 2020 17:59
@hardikmodha

hardikmodha commented Jan 5, 2020 •

Copy link
Copy Markdown
Contributor Author

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.

Makes sense. Each and every item is a link in summary we can do that.

@hardikmodha

Copy link
Copy Markdown
Contributor Author

@fregante I have incorporated the changes to point to the oldest commit in the repo-age but this introduces a change that will break for existing cached values. I'm now expecting cached values to be a valid JSON string but they are date strings.
Do we want to handle it for the existing values?

@yakov116

yakov116 commented Jan 5, 2020 •

Copy link
Copy Markdown
Member

@hardikmodha looks great. One thing with this change there is a noticeable jump on every load.

@hardikmodha

Copy link
Copy Markdown
Contributor Author

@yakov116 Yes, I noticed that as well. I'm working on adding some sort of loader icon as we discussed.

@fregante

fregante commented Jan 5, 2020

Copy link
Copy Markdown
Member

No need to get fancy with loaders. The user timezone feature just uses a static Guessing timezone… placeholder

@fregante

fregante commented Jan 5, 2020

Copy link
Copy Markdown
Member

Do we want to handle it for the existing values?

I think it’s nicer to handle that now and drop the code later rather than add extra text to our clear key name 😁

Comment thread source/features/repo-age.tsx Resolved
Comment thread source/features/repo-age.tsx Resolved
Comment thread source/features/repo-age.tsx Resolved
Comment thread source/features/repo-age.tsx Resolved
@yakov116

yakov116 commented Jan 5, 2020

Copy link
Copy Markdown
Member
❌ repo-age
content.js:3474 RangeError: Invalid time value
    at repo_age_init (content.js:9396)
    at async features_run (content.js:3469)

@hardikmodha
hardikmodha force-pushed the use_first_commit_for_repo_age branch from 7a61131 to e631a12 Compare January 5, 2020 19:59
@hardikmodha

Copy link
Copy Markdown
Contributor Author

@yakov116 I was not handling the existing cached values previously. Now, I am. Can you check again?

@yakov116

yakov116 commented Jan 5, 2020 •

Copy link
Copy Markdown
Member

@hardikmodha nope try
https://github.com/sindresorhus/got
Its crashing on title: First commit dated ${dateFormatter.format(date)}

@hardikmodha

Copy link
Copy Markdown
Contributor Author

@yakov116 It's working for me. Are you sure on the latest commit?

@yakov116

yakov116 commented Jan 5, 2020

Copy link
Copy Markdown
Member

Yup

@yakov116

yakov116 commented Jan 6, 2020

Copy link
Copy Markdown
Member

@hardikmodha I also noticed it will fail on any link that the path has tree in it (open a file from this pr and go to the main page)

Comment thread source/features/repo-age.tsx Resolved
Comment thread source/features/repo-age.tsx Resolved
Comment thread source/features/repo-age.tsx Resolved
Comment thread source/features/repo-age.tsx Resolved
@fregante

fregante commented Jan 6, 2020 •

Copy link
Copy Markdown
Member

If this is starting to look like a lot of moving parts, you can also split the PR into 2 pieces:

  • use updated data source (the initial intent of the PR)
  • add "loading..."
  • or even a 3rd piece: add link (which means changing the data format) (this was why I marked the suggestion as "Just a thought for now")

@hardikmodha
hardikmodha force-pushed the use_first_commit_for_repo_age branch from 40f0850 to 6a399ba Compare January 12, 2020 14:57
@hardikmodha
hardikmodha requested a review from fregante January 12, 2020 15:00
Comment thread source/features/repo-age.tsx Resolved
return false;
}

if (commitsCount === 1) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think repos with a single commit are rare enough that we can drop this condition.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Then, What do we display for 1 commit repo?

@fregante fregante Jan 14, 2020 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Without this condition, it will just continue like it would with more commits, to fetchDom etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

But the request would not return anything, the page returned by fetchDom would be empty and we won't find any commits there....

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ouch. Didn’t think it would be. I guess it can stay then.

Comment thread source/features/repo-age.tsx Resolved
Comment thread source/features/repo-age.tsx Resolved
Comment thread source/features/repo-age.tsx Resolved
@fregante

Copy link
Copy Markdown
Member

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

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

Development

Successfully merging this pull request may close these issues.

repo-age should display the date of the first commit

4 participants