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(issue-views): add query counts back to tabs #82990

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

MichaelSun48
Copy link
Member

@MichaelSun48 MichaelSun48 commented Jan 7, 2025

Pending this PR to be merged.

Adds the query count back to issue view tabs, this time with a hard max of 99 (counts will not go above 99 even after clicking into the tab, unlike before).

image

Temp view also works:

image

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 7, 2025
Copy link

codecov bot commented Jan 7, 2025

❌ 10 Tests Failed:

Tests completed Failed Passed Skipped
8481 10 8471 0
View the top 3 failed tests by shortest run time
IssueViewsHeader CustomViewsHeader initialization and router behavior initially selects a temporary tab if a foreign viewId and a query is present in the url
Stack Traces | 1.02s run time
Error: Unable to find role="tab" and name "High Priority"

Ignored nodes: comments, script, style
...
    at waitForWrapper (.../sentry/sentry/node_modules/@.../dom/dist/wait-for.js:163:27)
    at .../sentry/sentry/node_modules/@.../dom/dist/query-helpers.js:86:33
    at Object.<anonymous> (.../views/issueList/issueViewsHeader.spec.tsx:251:48)
    at Promise.then.completed (.../sentry/sentry/node_modules/jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../sentry/sentry/node_modules/jest-circus/build/utils.js:231:10)
    at _callCircusTest (.../sentry/sentry/node_modules/jest-circus/build/run.js:316:40)
    at _runTest (.../sentry/sentry/node_modules/jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (.../sentry/sentry/node_modules/jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../sentry/sentry/node_modules/jest-circus/build/run.js:121:9)
    at _runTestsForDescribeBlock (.../sentry/sentry/node_modules/jest-circus/build/run.js:121:9)
    at run (.../sentry/sentry/node_modules/jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../sentry/sentry/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../sentry/sentry/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../sentry/sentry/node_modules/jest-runner/build/runTest.js:367:16)
    at runTest (.../sentry/sentry/node_modules/jest-runner/build/runTest.js:444:34)
    at Object.worker (.../sentry/sentry/node_modules/jest-runner/build/testWorker.js:106:12)
IssueViewsHeader CustomViewsHeader initialization and router behavior updates the unsaved changes indicator for a default tab if the query is different
Stack Traces | 1.02s run time
Error: Unable to find role="tab" and name "Prioritized"

Ignored nodes: comments, script, style
...
    at waitForWrapper (.../sentry/sentry/node_modules/@.../dom/dist/wait-for.js:163:27)
    at .../sentry/sentry/node_modules/@.../dom/dist/query-helpers.js:86:33
    at Object.<anonymous> (.../views/issueList/issueViewsHeader.spec.tsx:305:48)
    at Promise.then.completed (.../sentry/sentry/node_modules/jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../sentry/sentry/node_modules/jest-circus/build/utils.js:231:10)
    at _callCircusTest (.../sentry/sentry/node_modules/jest-circus/build/run.js:316:40)
    at _runTest (.../sentry/sentry/node_modules/jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (.../sentry/sentry/node_modules/jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../sentry/sentry/node_modules/jest-circus/build/run.js:121:9)
    at _runTestsForDescribeBlock (.../sentry/sentry/node_modules/jest-circus/build/run.js:121:9)
    at run (.../sentry/sentry/node_modules/jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../sentry/sentry/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../sentry/sentry/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../sentry/sentry/node_modules/jest-runner/build/runTest.js:367:16)
    at runTest (.../sentry/sentry/node_modules/jest-runner/build/runTest.js:444:34)
    at Object.worker (.../sentry/sentry/node_modules/jest-runner/build/testWorker.js:106:12)
IssueViewsHeader CustomViewsHeader query behavior switches tabs when clicked, and updates the query params accordingly
Stack Traces | 1.03s run time
Error: Unable to find role="tab" and name "Medium Priority"

Ignored nodes: comments, script, style
...
    at waitForWrapper (.../sentry/sentry/node_modules/@.../dom/dist/wait-for.js:163:27)
    at .../sentry/sentry/node_modules/@.../dom/dist/query-helpers.js:86:33
    at Object.<anonymous> (.../views/issueList/issueViewsHeader.spec.tsx:340:84)
    at Promise.then.completed (.../sentry/sentry/node_modules/jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../sentry/sentry/node_modules/jest-circus/build/utils.js:231:10)
    at _callCircusTest (.../sentry/sentry/node_modules/jest-circus/build/run.js:316:40)
    at _runTest (.../sentry/sentry/node_modules/jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (.../sentry/sentry/node_modules/jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (.../sentry/sentry/node_modules/jest-circus/build/run.js:121:9)
    at _runTestsForDescribeBlock (.../sentry/sentry/node_modules/jest-circus/build/run.js:121:9)
    at run (.../sentry/sentry/node_modules/jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (.../sentry/sentry/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (.../sentry/sentry/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (.../sentry/sentry/node_modules/jest-runner/build/runTest.js:367:16)
    at runTest (.../sentry/sentry/node_modules/jest-runner/build/runTest.js:444:34)
    at Object.worker (.../sentry/sentry/node_modules/jest-runner/build/testWorker.js:106:12)

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

@MichaelSun48 MichaelSun48 force-pushed the msun/issueViews/addQueryCountsBack branch from 5469cbb to 5fd797d Compare January 7, 2025 17:48
@MichaelSun48 MichaelSun48 force-pushed the msun/issueViews/addQueryCountsBack branch from 5fd797d to fcf22f7 Compare January 7, 2025 17:49
@MichaelSun48 MichaelSun48 marked this pull request as ready for review January 7, 2025 17:52
@MichaelSun48 MichaelSun48 requested a review from a team as a code owner January 7, 2025 17:52
@MichaelSun48 MichaelSun48 requested a review from malwilley January 7, 2025 17:52
@@ -144,6 +144,7 @@ const UnselectedTabTitle = styled('div')<{isSelected: boolean}>`
text-overflow: ellipsis;
padding-right: 1px;
cursor: pointer;
line-height: 1.45;
Copy link
Member Author

Choose a reason for hiding this comment

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

Very minor change to align the view name better with the count:

Before:

image

After:

image

Copy link
Member

@malwilley malwilley left a comment

Choose a reason for hiding this comment

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

Noting a couple things that feel a bit off:

Not sure how to reproduce consistently, but sometimes when switching projects I get an empty query count

CleanShot 2025-01-07 at 10 03 35

Also searching a new query doesn't update the query count for a saved tab (maybe this is expected though?)

CleanShot 2025-01-07 at 10 04 49

@@ -31,6 +31,7 @@ export const useFetchIssueCounts = (
) => {
return useApiQuery<QueryCounts>(makeFetchIssueCounts(params), {
staleTime: 0,
placeholderData: keepPreviousData,
Copy link
Member Author

Choose a reason for hiding this comment

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

We want to keep previous data while new data loads so that the query count bubble doesn't change size while the new count loads. If this were not here, the previous data would be scrubbed, and the query count bubble would lose its content and shrink to its min width before growing again.

@MichaelSun48 MichaelSun48 requested a review from malwilley January 7, 2025 21:55
@MichaelSun48
Copy link
Member Author

@malwilley both of those were unintentional bugs and are fixed now!

@malwilley
Copy link
Member

@MichaelSun48 some failing tests!

Also noticed that the loading state looks too white in dark mode:

CleanShot 2025-01-07 at 14 36 35

And it may make sense to increase the stale time for the hook that fetches these counts. If you go to another page and come back it refetches everything and shows the loading state, which can be very long for some of my views

Comment on lines +86 to +89
expect(await screen.findByRole('tab', {name: /High Priority/})).toBeInTheDocument();
expect(screen.getByRole('tab', {name: /Medium Priority/})).toBeInTheDocument();
expect(screen.getByRole('tab', {name: /Low Priority/})).toBeInTheDocument();
expect(screen.getByRole('tab', {name: /High Priority/})).toHaveAttribute(
Copy link
Member Author

Choose a reason for hiding this comment

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

Somewhat jank way to fix the test failures - because the queryCount and tab title were adjacent components, RTL concatenated the strings, so the name of the "High Priority" tab with 12 counts would register "High Priority 12" instead of just "High Priority". I tried a bunch of things in the component themselves to make it work, but it ended up getting more complex than it should be to just make tests work, and I'd rather have the jank live in tests rather than in the components.

animate={{
backgroundColor: queryCountFetching
? [theme.surface400, theme.surface100, theme.surface400]
: `#00000000`,
Copy link
Member Author

@MichaelSun48 MichaelSun48 Jan 8, 2025

Choose a reason for hiding this comment

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

I think there are some issues with just using 'transparent' here - there are some consloe warnings about not being able to interpolate the hex values with the transparent keyword, hence why we're using #000000 here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants