Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: Refactor useCommits to use typescript #2506

Merged
merged 3 commits into from
Jan 11, 2024
Merged

Conversation

RulaKhaled
Copy link
Contributor

@RulaKhaled RulaKhaled commented Jan 11, 2024

Description

Refactoring useCommits hook to ease the refactor of commits tables

Notable Changes

  • Typescript the hook
  • Update patchPercent in the commits table (it's preferable to use it)
  • Update pull request tab count
  • Tests

Screenshots

nothing visual changes

closes #2505

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Verified

This commit was signed with the committer’s verified signature.
RulaKhaled Rola Abuhasna
@codecov-staging
Copy link

codecov-staging bot commented Jan 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2506   +/-   ##
=======================================
  Coverage   98.25%   98.25%           
=======================================
  Files         784      784           
  Lines       10004    10020   +16     
  Branches     2546     2500   -46     
=======================================
+ Hits         9829     9845   +16     
  Misses        173      173           
  Partials        2        2           
Files Coverage Δ
...estPage/PullRequestPageTabs/hooks/useTabsCounts.js 100.00% <ø> (ø)
.../subroute/CommitsTab/CommitsTable/CommitsTable.jsx 100.00% <100.00%> (ø)
.../RepoPage/CommitsTab/CommitsTable/CommitsTable.jsx 100.00% <100.00%> (ø)
src/services/commits/useCommits.tsx 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 59.37% <ø> (ø)
Layouts 96.95% <ø> (ø)
Pages 99.23% <100.00%> (ø)
Services 99.49% <100.00%> (+<0.01%) ⬆️
Shared 99.82% <ø> (ø)
UI 94.17% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 273a12f...b9e28cf. Read the comment docs.

Copy link

codecov-public-qa bot commented Jan 11, 2024

Codecov Report

Merging #2506 (b9e28cf) into main (273a12f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2506   +/-   ##
=======================================
  Coverage   98.25%   98.25%           
=======================================
  Files         784      784           
  Lines       10004    10020   +16     
  Branches     2495     2502    +7     
=======================================
+ Hits         9829     9845   +16     
  Misses        173      173           
  Partials        2        2           
Files Coverage Δ
...estPage/PullRequestPageTabs/hooks/useTabsCounts.js 100.00% <ø> (ø)
.../subroute/CommitsTab/CommitsTable/CommitsTable.jsx 100.00% <100.00%> (ø)
.../RepoPage/CommitsTab/CommitsTable/CommitsTable.jsx 100.00% <100.00%> (ø)
src/services/commits/useCommits.tsx 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 59.37% <ø> (ø)
Layouts 96.95% <ø> (ø)
Pages 99.23% <100.00%> (ø)
Services 99.49% <100.00%> (+<0.01%) ⬆️
Shared 99.82% <ø> (ø)
UI 94.17% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 273a12f...b9e28cf. Read the comment docs.

@codecov-qa
Copy link

codecov-qa bot commented Jan 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (273a12f) 98.25% compared to head (b9e28cf) 98.25%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2506   +/-   ##
=======================================
  Coverage   98.25%   98.25%           
=======================================
  Files         784      784           
  Lines       10004    10020   +16     
  Branches     2497     2546   +49     
=======================================
+ Hits         9829     9845   +16     
  Misses        173      173           
  Partials        2        2           
Files Coverage Δ
...estPage/PullRequestPageTabs/hooks/useTabsCounts.js 100.00% <ø> (ø)
.../subroute/CommitsTab/CommitsTable/CommitsTable.jsx 100.00% <100.00%> (ø)
.../RepoPage/CommitsTab/CommitsTable/CommitsTable.jsx 100.00% <100.00%> (ø)
src/services/commits/useCommits.tsx 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 59.37% <ø> (ø)
Layouts 96.95% <ø> (ø)
Pages 99.23% <100.00%> (ø)
Services 99.49% <100.00%> (+<0.01%) ⬆️
Shared 99.82% <ø> (ø)
UI 94.17% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 273a12f...b9e28cf. Read the comment docs.

Copy link

netlify bot commented Jan 11, 2024

Deploy Preview for gazebo-staging ready!

Name Link
🔨 Latest commit b9e28cf
🔍 Latest deploy log https://app.netlify.com/sites/gazebo-staging/deploys/65a00f199f4eff0007bb1a9e
😎 Deploy Preview https://deploy-preview-2506--gazebo-staging.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Jan 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (273a12f) 98.25% compared to head (b9e28cf) 98.25%.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #2506   +/-   ##
=====================================
  Coverage   98.25   98.25           
=====================================
  Files        784     784           
  Lines      10004   10020   +16     
  Branches    2527    2502   -25     
=====================================
+ Hits        9829    9845   +16     
  Misses       173     173           
  Partials       2       2           
Files Coverage Δ
...estPage/PullRequestPageTabs/hooks/useTabsCounts.js 100.00% <ø> (ø)
.../subroute/CommitsTab/CommitsTable/CommitsTable.jsx 100.00% <100.00%> (ø)
.../RepoPage/CommitsTab/CommitsTable/CommitsTable.jsx 100.00% <100.00%> (ø)
src/services/commits/useCommits.tsx 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 59.37% <ø> (ø)
Layouts 96.95% <ø> (ø)
Pages 99.23% <100.00%> (ø)
Services 99.49% <100.00%> (+<0.01%) ⬆️
Shared 99.82% <ø> (ø)
UI 94.17% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 273a12f...b9e28cf. Read the comment docs.

Copy link
Contributor

@nicholas-codecov nicholas-codecov left a comment

Choose a reason for hiding this comment

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

Few comments

Comment on lines 140 to 147
totals {
coverage
}
parent {
totals {
coverage
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

m: Can you update the two coverage fields here to be percentCovered instead of having to do a bunch of work you can just alias them, just so we're not using deprecated fields, something like:

totals {
  coverage: percentCovered
}
parent {
  totals {
    coverage: percentCovered
  }
}

@@ -39,6 +39,6 @@ export const useTabsCounts = () => {
componentsCount: compareWithBase?.componentComparisonsCount,
indirectChangesCount: compareWithBase?.indirectChangedFilesCount,
directChangedFilesCount: compareWithBase?.directChangedFilesCount,
commitsCount: commitsData?.commitsCount,
commitsCount: commitsData?.pages[0]?.commitsCount,
Copy link
Contributor

@nicholas-codecov nicholas-codecov Jan 11, 2024

Choose a reason for hiding this comment

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

l: Just so we don't have an error here if the list is empty you can do optional chaining with index accessing:

commitsCount: commitsData?.pages?.[0]?.commitsCount,

Verified

This commit was signed with the committer’s verified signature.
RulaKhaled Rola Abuhasna
Copy link
Contributor

@nicholas-codecov nicholas-codecov left a comment

Choose a reason for hiding this comment

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

Thanks for those quick fixes, approved ✅

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@RulaKhaled RulaKhaled merged commit 35a547f into main Jan 11, 2024
@RulaKhaled RulaKhaled deleted the refactor-commits-hook branch January 11, 2024 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor useCommits hook to use typescript
2 participants