Skip to content

ref: #597 - Flags Table Refactor Part 3 - #2714

Merged
ajay-sentry merged 18 commits into
mainfrom
Ajay/597-part-3-table-ref
Mar 26, 2024
Merged

ajay-sentry merged 18 commits into
mainfrom
Ajay/597-part-3-table-ref

Conversation

@ajay-sentry

@ajay-sentry ajay-sentry commented Mar 18, 2024 •

Copy link
Copy Markdown
Contributor

Description

This PR covers refactoring the FlagsTable from the old-ui table to the new pattern. One tricky thing with this particular table was it has a nested table, and after working with @nicholas-codecov, as well as spending ~3 days myself triaging some ghost rerendering issues, we were able to workaround it via Memoizing the table creation using const Table = memo(Component)

Outside of this, I removed the sorting mechanism within the useRepoFlagsTable hook since I think we get it for free without needing to do the additional network calls via the inline sorting functionality from the tanstack table. At least, when working locally that looked to be the case.

  • This change set has been reverted in fbd6d15, as well as adding infinite scroll functionality

This file along with the spec has also been converted to TS, with the tableData type being the only missing type, until we find some time to go back and refactor that one which will give us the tableData type for free.

Screenshots

Screen.Recording.2024-03-20.at.9.24.33.AM.mov

Link to Sample Entry

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.

{
node: {
name: 'flag1',
name: 'flagA',

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.

renamed these to test the sorting functionality

(measurements.length > 0 && measurements.every(({ avg }) => avg === null))

function TableSparkline({ measurements, change, name }) {
export type TableSparklineProps = {

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.

These are just the propType props, but written with TS

: SortingDirection.ASC

const useMeasurementVariables = (historicalTrend, oldestCommitAt) => {
const createMeasurementVariables = (historicalTrend, oldestCommitAt) => {

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.

renamed from "use" since it's not actually a hook

@@ -1,5 +1,24 @@
td {
.tableui table {

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.

Some style overrides I needed to do in order to get the styles to play nicely for the nested table

@codecov-staging

codecov-staging Bot commented Mar 18, 2024 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 97.56098% with 2 lines in your changes are missing coverage. Please review.

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2714      +/-   ##
==========================================
- Coverage   98.44%   98.42%   -0.02%     
==========================================
  Files         855      855              
  Lines       11990    12019      +29     
  Branches     3115     3178      +63     
==========================================
+ Hits        11803    11830      +27     
- Misses        184      185       +1     
- Partials        3        4       +1     
Files Coverage Δ
...ubroute/FlagsTable/TableEntries/TableSparkline.tsx 100.00% <100.00%> (ø)
...Tab/subroute/FlagsTable/hooks/useRepoFlagsTable.js 100.00% <100.00%> (ø)
src/services/repo/useRepoFlags.js 100.00% <100.00%> (ø)
src/ui/Sparkline/Sparkline.tsx 100.00% <ø> (ø)
src/ui/Sparkline/sparkline.css 100.00% <100.00%> (ø)
...poPage/FlagsTab/subroute/FlagsTable/FlagsTable.tsx 97.10% <97.10%> (ø)
Components Coverage Δ
Assets 55.55% <ø> (ø)
Layouts 97.13% <ø> (ø)
Pages 99.31% <97.50%> (-0.03%) ⬇️
Services 99.57% <100.00%> (ø)
Shared 99.83% <ø> (ø)
UI 94.17% <100.00%> (ø)

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 cf01943...3edfb0b. Read the comment docs.

@codecov-qa

codecov-qa Bot commented Mar 18, 2024 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 97.56098% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 98.42%. Comparing base (cf01943) to head (3edfb0b).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2714      +/-   ##
==========================================
- Coverage   98.44%   98.42%   -0.02%     
==========================================
  Files         855      855              
  Lines       11990    12019      +29     
  Branches     3115     3159      +44     
==========================================
+ Hits        11803    11830      +27     
- Misses        184      185       +1     
- Partials        3        4       +1     
Files Coverage Δ
...ubroute/FlagsTable/TableEntries/TableSparkline.tsx 100.00% <100.00%> (ø)
...Tab/subroute/FlagsTable/hooks/useRepoFlagsTable.js 100.00% <100.00%> (ø)
src/services/repo/useRepoFlags.js 100.00% <100.00%> (ø)
src/ui/Sparkline/Sparkline.tsx 100.00% <ø> (ø)
src/ui/Sparkline/sparkline.css 100.00% <100.00%> (ø)
...poPage/FlagsTab/subroute/FlagsTable/FlagsTable.tsx 97.10% <97.10%> (ø)
Components Coverage Δ
Assets 55.55% <ø> (ø)
Layouts 97.13% <ø> (ø)
Pages 99.31% <97.50%> (-0.03%) ⬇️
Services 99.57% <100.00%> (ø)
Shared 99.83% <ø> (ø)
UI 94.17% <100.00%> (ø)

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 cf01943...3edfb0b. Read the comment docs.

@nicholas-codecov

Copy link
Copy Markdown
Contributor

Outside of this, I removed the sorting mechanism within the useRepoFlagsTable hook since I think we get it for free without needing to do the additional network calls via the inline sorting functionality from the tanstack table. At least, when working locally that looked to be the case.

My only concern with this, is that the flags are paginated iirc, so when sorting you won't actually be sorting all of the flags because some will be hidden on the API/DB side of things. Wondering also, if you're able to add in infinite scroll replacing the "Load More" button. That is something else we're trying to do while we're refactoring these tables.

@codecov

codecov Bot commented Mar 18, 2024 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 97.56098% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 98.43%. Comparing base (cf01943) to head (3edfb0b).

✅ All tests successful. No failed tests found ☺️

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #2714     +/-   ##
=======================================
- Coverage   98.44   98.43   -0.01     
=======================================
  Files        855     855             
  Lines      11990   12019     +29     
  Branches    3160    3178     +18     
=======================================
+ Hits       11803   11830     +27     
- Misses       184     185      +1     
- Partials       3       4      +1     
Files Coverage Δ
...ubroute/FlagsTable/TableEntries/TableSparkline.tsx 100.00% <100.00%> (ø)
...Tab/subroute/FlagsTable/hooks/useRepoFlagsTable.js 100.00% <100.00%> (ø)
src/services/repo/useRepoFlags.js 100.00% <100.00%> (ø)
src/ui/Sparkline/Sparkline.tsx 100.00% <ø> (ø)
src/ui/Sparkline/sparkline.css 100.00% <100.00%> (ø)
...poPage/FlagsTab/subroute/FlagsTable/FlagsTable.tsx 97.10% <97.10%> (ø)
Components Coverage Δ
Assets 55.55% <ø> (ø)
Layouts 97.13% <ø> (ø)
Pages 99.31% <97.50%> (-0.03%) ⬇️
Services 99.57% <100.00%> (ø)
Shared 99.83% <ø> (ø)
UI 94.17% <100.00%> (ø)

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 cf01943...3edfb0b. Read the comment docs.

@codecov-staging

codecov-staging Bot commented Mar 18, 2024 •

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 4.81kB ⬆️

Bundle name Size Change
gazebo-staging-array-push 5.95MB 4.81kB ⬆️

@codecov

codecov Bot commented Mar 18, 2024 •

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 4.81kB ⬆️

Bundle name Size Change
gazebo-production-array-push 5.95MB 4.81kB ⬆️

@codecov-releaser

codecov-releaser commented Mar 18, 2024 •

Copy link
Copy Markdown
Collaborator

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Commit Created Cloud Enterprise
32a7749 Mon, 18 Mar 2024 20:40:24 GMT Expired Expired
fbd6d15 Mon, 18 Mar 2024 21:54:22 GMT Expired Expired
fbd6d15 Mon, 18 Mar 2024 21:54:44 GMT Expired Expired
710262c Mon, 18 Mar 2024 22:05:15 GMT Expired Expired
be1cc30 Tue, 19 Mar 2024 18:29:10 GMT Expired Expired
be1cc30 Tue, 19 Mar 2024 18:30:23 GMT Expired Expired
c57f50b Wed, 20 Mar 2024 16:33:32 GMT Expired Expired
c57f50b Wed, 20 Mar 2024 16:34:57 GMT Expired Expired
3edfb0b Tue, 26 Mar 2024 18:01:09 GMT Cloud Enterprise

@codecov-public-qa

codecov-public-qa Bot commented Mar 18, 2024 •

Copy link
Copy Markdown

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (cf01943) 98.44% compared to head (3edfb0b) 98.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2714      +/-   ##
==========================================
- Coverage   98.44%   98.42%   -0.02%     
==========================================
  Files         855      855              
  Lines       11990    12019      +29     
  Branches     3113     3178      +65     
==========================================
+ Hits        11803    11830      +27     
- Misses        184      185       +1     
- Partials        3        4       +1     
Files Coverage Δ
...ubroute/FlagsTable/TableEntries/TableSparkline.tsx 100.00% <100.00%> (ø)
...Tab/subroute/FlagsTable/hooks/useRepoFlagsTable.js 100.00% <100.00%> (ø)
src/services/repo/useRepoFlags.js 100.00% <100.00%> (ø)
src/ui/Sparkline/Sparkline.tsx 100.00% <ø> (ø)
src/ui/Sparkline/sparkline.css 100.00% <100.00%> (ø)
...poPage/FlagsTab/subroute/FlagsTable/FlagsTable.tsx 97.10% <97.10%> (ø)
Components Coverage Δ
Assets 55.55% <ø> (ø)
Layouts 97.13% <ø> (ø)
Pages 99.31% <97.50%> (-0.03%) ⬇️
Services 99.57% <100.00%> (ø)
Shared 99.83% <ø> (ø)
UI 94.17% <100.00%> (ø)

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 cf01943...3edfb0b. Read the comment docs.

@nicholas-codecov

Copy link
Copy Markdown
Contributor

Just a couple little things looking at the preview deploy before diving into the code:

  • Loading indicator needs to be centre aligned

Screenshot 2024-03-19 at 07 14 55

  • Table headings don't align with the data columns

Screenshot 2024-03-19 at 07 15 17

  • Sorting arrows aren't showing up when sorting via the headers, no real screenshot to add here, as they're not showing up

@ajay-sentry

Copy link
Copy Markdown
Contributor Author

@nicholas-codecov Thanks for the feedback, added a new video fixing the arrow, row styling and loader styling

@nicholas-codecov

Copy link
Copy Markdown
Contributor

Just looking at the current table, the coverage and trend header text should be right aligned not left aligned

@nicholas-codecov nicholas-codecov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One thing to look at here, and the previous comment

Comment on lines +30 to +33
name: JSX.Element
coverage: JSX.Element
trend: JSX.Element
delete: JSX.Element | null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you swap these to React.ReactNode as JSX.Element does not allow valid returns such as null, number, etc.

@nicholas-codecov nicholas-codecov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Awesome work, thanks for those changes!

@ajay-sentry
ajay-sentry merged commit 8f2d944 into main Mar 26, 2024
@ajay-sentry
ajay-sentry deleted the Ajay/597-part-3-table-ref branch March 26, 2024 18:38
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.

3 participants