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

fix: Scroll to line padding #2814

Merged
merged 11 commits into from
Apr 29, 2024
Merged

Conversation

nicholas-codecov
Copy link
Contributor

Description

This PR cleans up some of the instances of useScrollToLine to fix the padding issues with headers, when both BA and Coverage are enabled, and to use a shared const throughout the app so we only have to adjust the values in one place.

Notable Changes

  • Convert/Update DiffLine to TS and to accept stickyPadding prop
  • Update other instances of stickyPadding to use const obj
  • Update tests
  • Update stories

Copy link

codecov-public-qa bot commented Apr 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.47%. Comparing base (782e9b4) to head (66caba8).

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2814   +/-   ##
=======================================
  Coverage   98.46%   98.47%           
=======================================
  Files         871      871           
  Lines       12676    12686   +10     
  Branches     3332     3388   +56     
=======================================
+ Hits        12482    12492   +10     
  Misses        190      190           
  Partials        4        4           
Files Coverage Δ
.../CommitDetailFileViewer/CommitDetailFileViewer.jsx 100.00% <ø> (ø)
...hangedTab/shared/CommitFileDiff/CommitFileDiff.jsx 100.00% <100.00%> (ø)
...rectChangesTable/CommitFileDiff/CommitFileDiff.jsx 100.00% <100.00%> (ø)
...Page/PullCoverage/routes/FileViewer/FileViewer.jsx 100.00% <ø> (ø)
...outes/FilesChangedTab/shared/FileDiff/FileDiff.jsx 100.00% <100.00%> (ø)
...ge/routes/IndirectChangesTab/FileDiff/FileDiff.jsx 100.00% <100.00%> (ø)
...age/CoverageTab/subroute/Fileviewer/Fileviewer.jsx 100.00% <ø> (ø)
src/shared/utils/fileviewer.tsx 100.00% <100.00%> (ø)
src/ui/CodeRenderer/DiffLine/DiffLine.tsx 100.00% <100.00%> (ø)
src/ui/CodeRenderer/hooks/useScrollToLine.js 94.91% <100.00%> (ø)
Components Coverage Δ
Assets 55.55% <ø> (ø)
Layouts 97.25% <ø> (ø)
Pages 99.26% <100.00%> (+<0.01%) ⬆️
Services 99.56% <ø> (ø)
Shared 99.84% <100.00%> (+<0.01%) ⬆️
UI 94.40% <100.00%> (+<0.01%) ⬆️

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 782e9b4...66caba8. Read the comment docs.

@codecov-qa
Copy link

codecov-qa bot commented Apr 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.47%. Comparing base (782e9b4) to head (66caba8).

✅ All tests successful. No failed tests found ☺️

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2814   +/-   ##
=======================================
  Coverage   98.46%   98.47%           
=======================================
  Files         871      871           
  Lines       12676    12686   +10     
  Branches     3395     3388    -7     
=======================================
+ Hits        12482    12492   +10     
  Misses        190      190           
  Partials        4        4           
Files Coverage Δ
.../CommitDetailFileViewer/CommitDetailFileViewer.jsx 100.00% <ø> (ø)
...hangedTab/shared/CommitFileDiff/CommitFileDiff.jsx 100.00% <100.00%> (ø)
...rectChangesTable/CommitFileDiff/CommitFileDiff.jsx 100.00% <100.00%> (ø)
...Page/PullCoverage/routes/FileViewer/FileViewer.jsx 100.00% <ø> (ø)
...outes/FilesChangedTab/shared/FileDiff/FileDiff.jsx 100.00% <100.00%> (ø)
...ge/routes/IndirectChangesTab/FileDiff/FileDiff.jsx 100.00% <100.00%> (ø)
...age/CoverageTab/subroute/Fileviewer/Fileviewer.jsx 100.00% <ø> (ø)
src/shared/utils/fileviewer.tsx 100.00% <100.00%> (ø)
src/ui/CodeRenderer/DiffLine/DiffLine.tsx 100.00% <100.00%> (ø)
src/ui/CodeRenderer/hooks/useScrollToLine.js 94.91% <100.00%> (ø)
Components Coverage Δ
Assets 55.55% <ø> (ø)
Layouts 97.25% <ø> (ø)
Pages 99.26% <100.00%> (+<0.01%) ⬆️
Services 99.56% <ø> (ø)
Shared 99.84% <100.00%> (+<0.01%) ⬆️
UI 94.40% <100.00%> (+<0.01%) ⬆️

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 782e9b4...66caba8. Read the comment docs.

Copy link

codecov bot commented Apr 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.47%. Comparing base (782e9b4) to head (66caba8).

✅ All tests successful. No failed tests found ☺️

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #2814   +/-   ##
=====================================
  Coverage   98.47   98.47           
=====================================
  Files        871     871           
  Lines      12676   12686   +10     
  Branches    3332    3388   +56     
=====================================
+ Hits       12482   12492   +10     
  Misses       190     190           
  Partials       4       4           
Files Coverage Δ
.../CommitDetailFileViewer/CommitDetailFileViewer.jsx 100.00% <ø> (ø)
...hangedTab/shared/CommitFileDiff/CommitFileDiff.jsx 100.00% <100.00%> (ø)
...rectChangesTable/CommitFileDiff/CommitFileDiff.jsx 100.00% <100.00%> (ø)
...Page/PullCoverage/routes/FileViewer/FileViewer.jsx 100.00% <ø> (ø)
...outes/FilesChangedTab/shared/FileDiff/FileDiff.jsx 100.00% <100.00%> (ø)
...ge/routes/IndirectChangesTab/FileDiff/FileDiff.jsx 100.00% <100.00%> (ø)
...age/CoverageTab/subroute/Fileviewer/Fileviewer.jsx 100.00% <ø> (ø)
src/shared/utils/fileviewer.tsx 100.00% <100.00%> (ø)
src/ui/CodeRenderer/DiffLine/DiffLine.tsx 100.00% <100.00%> (ø)
src/ui/CodeRenderer/hooks/useScrollToLine.js 94.91% <100.00%> (ø)
Components Coverage Δ
Assets 55.55% <ø> (ø)
Layouts 97.25% <ø> (ø)
Pages 99.26% <100.00%> (+<0.01%) ⬆️
Services 99.56% <ø> (ø)
Shared 99.84% <100.00%> (+<0.01%) ⬆️
UI 94.40% <100.00%> (+<0.01%) ⬆️

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 782e9b4...66caba8. Read the comment docs.

@codecov-staging
Copy link

codecov-staging bot commented Apr 29, 2024

Bundle Report

Changes will increase total bundle size by 777 bytes ⬆️

Bundle name Size Change
gazebo-staging-array-push 6.48MB 777 bytes ⬆️

Copy link

codecov bot commented Apr 29, 2024

Bundle Report

Changes will increase total bundle size by 777 bytes ⬆️

Bundle name Size Change
gazebo-production-array-push 6.48MB 777 bytes ⬆️

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Apr 29, 2024

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Commit Created Cloud Enterprise
0cd206e Mon, 29 Apr 2024 14:22:07 GMT Expired Expired
0cd206e Mon, 29 Apr 2024 14:22:42 GMT Expired Expired
e9d1ced Mon, 29 Apr 2024 16:26:19 GMT Expired Expired
1d8f111 Mon, 29 Apr 2024 16:43:59 GMT Expired Expired
1d8f111 Mon, 29 Apr 2024 16:48:59 GMT Expired Expired
66caba8 Mon, 29 Apr 2024 17:20:20 GMT Cloud Enterprise

@@ -88,12 +92,21 @@ export const CODE_RENDERER_INFO = {
} as const

// Enum from https://github.com/codecov/shared/blob/master/shared/utils/merge.py#L275-L279
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: think this comment is out of date if we can update

type LineContent = { types: Array<string>; content: string }

export interface DiffLineProps {
lineContent?: Array<LineContent>
Copy link
Contributor

Choose a reason for hiding this comment

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

curious on this changing from a required prop when we were using PropTypes to optional

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Typo

function DiffLine({
type LineContent = { types: Array<string>; content: string }

export interface DiffLineProps {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: thoughts on organizing props in required -> optional order?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updating to be alphabetical, follows the same pattern as the auto-complete

headCoverage={coverage[Math.floor(Math.random() * 3) % 3]}
baseCoverage={coverage[Math.floor(Math.random() * 3) % 3]}
headCoverage={
coverage[Math.floor(Math.random() * 3) % 3] ?? null
Copy link
Contributor

Choose a reason for hiding this comment

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

won't coverage always be a truthy value here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it can be undefined

Copy link
Contributor

@ajay-sentry ajay-sentry left a comment

Choose a reason for hiding this comment

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

Nothing blocking, just a couple comments

@nicholas-codecov nicholas-codecov merged commit d76d77c into main Apr 29, 2024
51 checks passed
@nicholas-codecov nicholas-codecov deleted the fix-scroll-to-line-with-dropdowns branch April 29, 2024 17:40
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.

None yet

3 participants