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: Migrate useRepos to TS Query V5 #3617

Merged
merged 15 commits into from
Jan 6, 2025

Conversation

nicholas-codecov
Copy link
Contributor

@nicholas-codecov nicholas-codecov commented Dec 31, 2024

Description

This PR migrates the useRepos hook over to the infiniteQueryOptions version ReposQueryOpts and to TS Query V5.

There's some changes with how the imports from the repos/config.ts file that will be cleaned up once the prior PR #3615 has been migrated, and this PR can be rebased off of it.

Ticket: codecov/engineering-team#2969

Notable Changes

  • Migrate useRepos to ReposQueryOpts
  • Update usage in ReposTable and ChartSelectors
  • Update imports from services/repos/config (removing barrel file)
  • Update/refactor tests

Copy link

codecov bot commented Dec 31, 2024

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
3467 2 3465 0
View the top 2 failed tests by shortest run time
src/services/repos/ReposTeamQueryOpts.test.tsx > ReposTeamQueryOpts > when call next page > returns repositories of the user
Stack Traces | 1.02s run time
AssertionError: expected { pages: [ { …(3) }, { …(3) } ], …(1) } to deeply equal { pages: [ { …(3) }, { …(3) } ], …(1) }

Ignored nodes: comments, script, style
<html>
  <head />
  <body>
    <div />
  </body>
</html>

- Expected
+ Received

  Object {
    "pageParams": Array [
-     undefined,
+     "",
      "MjAyMC0wOC0xMSAxNzozMDowMiswMDowMHwxMDA=",
    ],
    "pages": Array [
      Object {
        "isCurrentUserPartOfOrg": true,
        "pageInfo": Object {
          "endCursor": "MjAyMC0wOC0xMSAxNzozMDowMiswMDowMHwxMDA=",
          "hasNextPage": true,
        },
        "repos": Array [
          Object {
            "activated": true,
            "active": true,
            "author": Object {
              "username": "codecov",
            },
            "bundleAnalysisEnabled": true,
            "coverageAnalytics": Object {
              "lines": 99,
            },
            "coverageEnabled": true,
            "latestCommitAt": "2021-04-22T14:09:39.826948+00:00",
            "name": "codecov-bash",
            "private": false,
          },
          Object {
            "activated": true,
            "active": true,
            "author": Object {
              "username": "codecov",
            },
            "bundleAnalysisEnabled": true,
            "coverageAnalytics": Object {
              "lines": 99,
            },
            "coverageEnabled": true,
            "latestCommitAt": "2021-04-22T14:09:39.826948+00:00",
            "name": "codecov-bash-2",
            "private": false,
          },
        ],
      },
      Object {
        "isCurrentUserPartOfOrg": true,
        "pageInfo": Object {
          "endCursor": "aa",
          "hasNextPage": false,
        },
        "repos": Array [
          Object {
            "activated": true,
            "active": true,
            "author": Object {
              "username": "codecov",
            },
            "bundleAnalysisEnabled": true,
            "coverageAnalytics": Object {
              "lines": 99,
            },
            "coverageEnabled": true,
            "latestCommitAt": "2021-04-22T14:09:39.826948+00:00",
            "name": "codecov-bash-3",
            "private": false,
          },
          Object {
            "activated": true,
            "active": true,
            "author": Object {
              "username": "codecov",
            },
            "bundleAnalysisEnabled": true,
            "coverageAnalytics": Object {
              "lines": 99,
            },
            "coverageEnabled": true,
            "latestCommitAt": "2021-04-22T14:09:39.826948+00:00",
            "name": "codecov-bash-4",
            "private": false,
          },
        ],
      },
    ],
  }

 ❯ .../services/repos/ReposTeamQueryOpts.test.tsx:187:37runWithExpensiveErrorDiagnosticsDisabled node_modules/@.../dom/dist/config.js:47:12checkCallback node_modules/@.../dom/dist/wait-for.js:124:77Timeout.checkRealTimersCallback node_modules/@.../dom/dist/wait-for.js:118:16
src/services/repos/ReposTeamQueryOpts.test.tsx > ReposTeamQueryOpts > when called > returns repositories
Stack Traces | 1.06s run time
AssertionError: expected { pages: [ { …(3) } ], …(1) } to deeply equal { pages: [ { …(3) } ], …(1) }

Ignored nodes: comments, script, style
<html>
  <head />
  <body>
    <div />
  </body>
</html>

- Expected
+ Received

  Object {
    "pageParams": Array [
-     undefined,
+     "",
    ],
    "pages": Array [
      Object {
        "isCurrentUserPartOfOrg": true,
        "pageInfo": Object {
          "endCursor": "MjAyMC0wOC0xMSAxNzozMDowMiswMDowMHwxMDA=",
          "hasNextPage": true,
        },
        "repos": Array [
          Object {
            "activated": true,
            "active": true,
            "author": Object {
              "username": "codecov",
            },
            "bundleAnalysisEnabled": true,
            "coverageAnalytics": Object {
              "lines": 99,
            },
            "coverageEnabled": true,
            "latestCommitAt": "2021-04-22T14:09:39.826948+00:00",
            "name": "codecov-bash",
            "private": false,
          },
          Object {
            "activated": true,
            "active": true,
            "author": Object {
              "username": "codecov",
            },
            "bundleAnalysisEnabled": true,
            "coverageAnalytics": Object {
              "lines": 99,
            },
            "coverageEnabled": true,
            "latestCommitAt": "2021-04-22T14:09:39.826948+00:00",
            "name": "codecov-bash-2",
            "private": false,
          },
        ],
      },
    ],
  }

 ❯ .../services/repos/ReposTeamQueryOpts.test.tsx:148:37runWithExpensiveErrorDiagnosticsDisabled node_modules/@.../dom/dist/config.js:47:12checkCallback node_modules/@.../dom/dist/wait-for.js:124:77Timeout.checkRealTimersCallback node_modules/@.../dom/dist/wait-for.js:118:16

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

@codecov-qa
Copy link

codecov-qa bot commented Dec 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.98%. Comparing base (6500fd6) to head (d973d64).
Report is 4 commits behind head on main.

✅ All tests successful. No failed tests found.

@@            Coverage Diff             @@
##             main    #3617      +/-   ##
==========================================
- Coverage   98.98%   98.98%   -0.01%     
==========================================
  Files         810      811       +1     
  Lines       14564    14545      -19     
  Branches     4141     4128      -13     
==========================================
- Hits        14416    14397      -19     
  Misses        141      141              
  Partials        7        7              
Files with missing lines Coverage Δ
...inSettings/AdminMembers/MemberList/MemberTable.tsx 100.00% <ø> (ø)
src/pages/AnalyticsPage/AnalyticsPage.jsx 100.00% <ø> (ø)
...es/AnalyticsPage/ChartSelectors/ChartSelectors.jsx 100.00% <100.00%> (ø)
...route/FileExplorer/CodeTreeTable/CodeTreeTable.tsx 100.00% <ø> (ø)
...route/FileExplorer/FileListTable/FileListTable.tsx 100.00% <ø> (ø)
src/services/repos/ReposQueryOpts.tsx 100.00% <100.00%> (ø)
src/services/repos/ReposTeamQueryOpts.tsx 100.00% <100.00%> (ø)
src/shared/ListRepo/ListRepo.jsx 100.00% <ø> (ø)
src/shared/ListRepo/ReposTable/ReposTable.tsx 98.61% <100.00%> (ø)
...ared/ListRepo/ReposTable/getReposColumnsHelper.tsx 100.00% <ø> (ø)
... and 1 more

... and 14 files with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.72% <100.00%> (-0.01%) ⬇️
Services 99.33% <100.00%> (+<0.01%) ⬆️
Shared 99.37% <100.00%> (-0.01%) ⬇️
UI 99.14% <ø> (ø)

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 6500fd6...d973d64. Read the comment docs.

@codecov-notifications
Copy link

codecov-notifications bot commented Dec 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

@@            Coverage Diff             @@
##             main    #3617      +/-   ##
==========================================
- Coverage   98.98%   98.98%   -0.01%     
==========================================
  Files         810      811       +1     
  Lines       14564    14545      -19     
  Branches     4141     4121      -20     
==========================================
- Hits        14416    14397      -19     
  Misses        141      141              
  Partials        7        7              
Files with missing lines Coverage Δ
...inSettings/AdminMembers/MemberList/MemberTable.tsx 100.00% <ø> (ø)
src/pages/AnalyticsPage/AnalyticsPage.jsx 100.00% <ø> (ø)
...es/AnalyticsPage/ChartSelectors/ChartSelectors.jsx 100.00% <100.00%> (ø)
...route/FileExplorer/CodeTreeTable/CodeTreeTable.tsx 100.00% <ø> (ø)
...route/FileExplorer/FileListTable/FileListTable.tsx 100.00% <ø> (ø)
src/services/repos/ReposQueryOpts.tsx 100.00% <100.00%> (ø)
src/services/repos/ReposTeamQueryOpts.tsx 100.00% <100.00%> (ø)
src/shared/ListRepo/ListRepo.jsx 100.00% <ø> (ø)
src/shared/ListRepo/ReposTable/ReposTable.tsx 98.61% <100.00%> (ø)
...ared/ListRepo/ReposTable/getReposColumnsHelper.tsx 100.00% <ø> (ø)
... and 1 more

... and 14 files with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.72% <100.00%> (-0.01%) ⬇️
Services 99.33% <100.00%> (+<0.01%) ⬆️
Shared 99.37% <100.00%> (-0.01%) ⬇️
UI 99.14% <ø> (ø)

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 6500fd6...d973d64. Read the comment docs.

Copy link

codecov bot commented Dec 31, 2024

Bundle Report

Changes will decrease total bundle size by 409 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-system 6.0MB 133 bytes (-0.0%) ⬇️
gazebo-production-system-esm 6.06MB 276 bytes (-0.0%) ⬇️

@codecov-staging
Copy link

codecov-staging bot commented Dec 31, 2024

Bundle Report

Changes will decrease total bundle size by 409 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-staging-system-esm 6.06MB 276 bytes (-0.0%) ⬇️
gazebo-staging-system 6.0MB 133 bytes (-0.0%) ⬇️

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Dec 31, 2024

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
d51f2e5 Tue, 31 Dec 2024 17:14:26 GMT Expired Expired
0b83470 Tue, 31 Dec 2024 18:01:37 GMT Expired Expired
687bf29 Thu, 02 Jan 2025 12:27:30 GMT Expired Expired
0a0fab9 Thu, 02 Jan 2025 17:56:32 GMT Expired Expired
2d5ad3c Mon, 06 Jan 2025 16:17:02 GMT Expired Expired
245204e Mon, 06 Jan 2025 17:05:01 GMT Expired Expired
d973d64 Mon, 06 Jan 2025 18:29:27 GMT Cloud Enterprise

@nicholas-codecov nicholas-codecov force-pushed the gh-eng-2969-ref-useRepos-to-tsqv5 branch from d51f2e5 to cbf77dd Compare December 31, 2024 17:46
Copy link

codecov-public-qa bot commented Dec 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.98%. Comparing base (6500fd6) to head (d973d64).
Report is 4 commits behind head on main.

✅ All tests successful. No failed tests found.

@@            Coverage Diff             @@
##             main    #3617      +/-   ##
==========================================
- Coverage   98.98%   98.98%   -0.01%     
==========================================
  Files         810      811       +1     
  Lines       14564    14545      -19     
  Branches     4148     4121      -27     
==========================================
- Hits        14416    14397      -19     
  Misses        141      141              
  Partials        7        7              
Files with missing lines Coverage Δ
...inSettings/AdminMembers/MemberList/MemberTable.tsx 100.00% <ø> (ø)
src/pages/AnalyticsPage/AnalyticsPage.jsx 100.00% <ø> (ø)
...es/AnalyticsPage/ChartSelectors/ChartSelectors.jsx 100.00% <100.00%> (ø)
...route/FileExplorer/CodeTreeTable/CodeTreeTable.tsx 100.00% <ø> (ø)
...route/FileExplorer/FileListTable/FileListTable.tsx 100.00% <ø> (ø)
src/services/repos/ReposQueryOpts.tsx 100.00% <100.00%> (ø)
src/services/repos/ReposTeamQueryOpts.tsx 100.00% <100.00%> (ø)
src/shared/ListRepo/ListRepo.jsx 100.00% <ø> (ø)
src/shared/ListRepo/ReposTable/ReposTable.tsx 98.61% <100.00%> (ø)
...ared/ListRepo/ReposTable/getReposColumnsHelper.tsx 100.00% <ø> (ø)
... and 1 more

... and 14 files with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.72% <100.00%> (-0.01%) ⬇️
Services 99.33% <100.00%> (+<0.01%) ⬆️
Shared 99.37% <100.00%> (-0.01%) ⬇️
UI 99.14% <ø> (ø)

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 6500fd6...d973d64. Read the comment docs.

Copy link
Contributor

@calvin-codecov calvin-codecov left a comment

Choose a reason for hiding this comment

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

1 nit if you feel like adding.

Strange that we have that inconsistency. I went down a small rabbit hole to try to see if I could find out what was going on on the API side as it would be nice to keep it consistent.

@nicholas-codecov nicholas-codecov force-pushed the gh-eng-2969-ref-useRepos-to-tsqv5 branch from 0a0fab9 to 2d5ad3c Compare January 6, 2025 16:11
@nicholas-codecov nicholas-codecov added this pull request to the merge queue Jan 6, 2025
Merged via the queue into main with commit 82938e3 Jan 6, 2025
61 of 62 checks passed
@nicholas-codecov nicholas-codecov deleted the gh-eng-2969-ref-useRepos-to-tsqv5 branch January 6, 2025 18:46
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