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

feat: Default to All branches when default branch has no commits #2446

Conversation

nicholas-codecov
Copy link
Contributor

@nicholas-codecov nicholas-codecov commented Dec 8, 2023

Description

This PR makes it so that when you visit the commits tab of a repo whose default branch has no commits it will swap over to the All branches option by updating the query params on the initial render, so users can force their way back to the default branch if they wish to investigate further.

Closes codecov/engineering-team#870

Notable Changes

  • Add new useBranchHasCommits hook
  • Update CommitsTab to swap to All branches when default branch has no commits only on initial render.

Screenshots

Screen.Recording.2023-12-08.at.10.35.02.mov

Copy link

codecov bot commented Dec 8, 2023

Codecov Report

Merging #2446 (6b237c4) into main (ef9d544) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #2446     +/-   ##
=======================================
+ Coverage   98.07   98.08   +0.01     
=======================================
  Files        763     764      +1     
  Lines       9691    9724     +33     
  Branches    2397    2455     +58     
=======================================
+ Hits        9504    9537     +33     
  Misses       185     185             
  Partials       2       2             
Files Coverage Δ
src/pages/RepoPage/CommitsTab/CommitsTab.jsx 100.00% <100.00%> (ø)
src/services/branches/useBranchHasCommits.tsx 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 59.37% <ø> (ø)
Layouts 97.30% <ø> (ø)
Pages 98.92% <100.00%> (+<0.01%) ⬆️
Services 99.44% <100.00%> (+<0.01%) ⬆️
Shared 99.81% <ø> (ø)
UI 94.32% <ø> (ø)

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 ef9d544...6b237c4. Read the comment docs.

@codecov-qa
Copy link

codecov-qa bot commented Dec 8, 2023

Codecov Report

Merging #2446 (6b237c4) into main (ef9d544) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2446   +/-   ##
=======================================
  Coverage   98.07%   98.07%           
=======================================
  Files         763      764    +1     
  Lines        9691     9724   +33     
  Branches     2397     2436   +39     
=======================================
+ Hits         9504     9537   +33     
  Misses        185      185           
  Partials        2        2           
Files Coverage Δ
src/pages/RepoPage/CommitsTab/CommitsTab.jsx 100.00% <100.00%> (ø)
src/services/branches/useBranchHasCommits.tsx 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 59.37% <ø> (ø)
Layouts 97.30% <ø> (ø)
Pages 98.92% <100.00%> (+<0.01%) ⬆️
Services 99.44% <100.00%> (+<0.01%) ⬆️
Shared 99.81% <ø> (ø)
UI 94.32% <ø> (ø)

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 ef9d544...6b237c4. Read the comment docs.

Copy link

codecov-public-qa bot commented Dec 8, 2023

Codecov Report

Merging #2446 (6b237c4) into main (ef9d544) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2446   +/-   ##
=======================================
  Coverage   98.07%   98.07%           
=======================================
  Files         763      764    +1     
  Lines        9691     9724   +33     
  Branches     2441     2450    +9     
=======================================
+ Hits         9504     9537   +33     
  Misses        185      185           
  Partials        2        2           
Files Coverage Δ
src/pages/RepoPage/CommitsTab/CommitsTab.jsx 100.00% <100.00%> (ø)
src/services/branches/useBranchHasCommits.tsx 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 59.37% <ø> (ø)
Layouts 97.30% <ø> (ø)
Pages 98.92% <100.00%> (+<0.01%) ⬆️
Services 99.44% <100.00%> (+<0.01%) ⬆️
Shared 99.81% <ø> (ø)
UI 94.32% <ø> (ø)

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 ef9d544...6b237c4. Read the comment docs.

Copy link

netlify bot commented Dec 8, 2023

Deploy Preview for gazebo-staging ready!

Name Link
🔨 Latest commit 6b237c4
🔍 Latest deploy log https://app.netlify.com/sites/gazebo-staging/deploys/65776393124c1500083bf91e
😎 Deploy Preview https://deploy-preview-2446--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.

@nicholas-codecov nicholas-codecov force-pushed the gh-eng-870-default-to-all-branches-when-no-coverage-on-default-branch-on-commits-page branch from 1d69c8d to 1a54a56 Compare December 11, 2023 18:22
Copy link

@codecov codecov bot left a comment

Choose a reason for hiding this comment

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

The git diff provides an overall decent implementation, but there are a few key areas that need improvement or clarification. The main issues include hard-coded string values for data comparison, the use of low-level hooks, potential over-fetching of data, and a lack of clear error handling.

src/pages/RepoPage/CommitsTab/CommitsTab.jsx Outdated Show resolved Hide resolved
src/pages/RepoPage/CommitsTab/CommitsTab.jsx Show resolved Hide resolved
@nicholas-codecov nicholas-codecov merged commit df16311 into main Dec 11, 2023
49 checks passed
@nicholas-codecov nicholas-codecov deleted the gh-eng-870-default-to-all-branches-when-no-coverage-on-default-branch-on-commits-page branch December 11, 2023 19:38
@nicholas-codecov nicholas-codecov restored the gh-eng-870-default-to-all-branches-when-no-coverage-on-default-branch-on-commits-page branch December 11, 2023 19:45
nicholas-codecov added a commit that referenced this pull request Dec 11, 2023
nicholas-codecov added a commit that referenced this pull request Dec 11, 2023
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.

The commits page doesn't default to "All branches" if coverage isn't on the default branch
2 participants