-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(explore-attr-breakdowns): Persisting search #103918
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
Merged
+236
−89
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
6d5ff8e
feat(charts): Adding new chart range selection hook
bd08ba3
:hammer_and_wrench: apply pre-commit fixes
getsantry[bot] acd1453
feat(explore-attr-breakdowns): Using new useChartXRangeSelection hook
f4b4f9c
feat(explore-attr-breakdowns): Removing old hook
2be7db5
feat(explore-attribute-breakdowns): Addressing cursor comments
1f7a760
Merge branch 'abdk/useChartXrangeSelection' into abdk/explore-attr-ne…
1fee70f
feat(explore-attribute-breakdowns): Minor cleanup
0dd6897
feat(explore-attribute-breakdowns): Fixing knip errors
a6ed0de
feat(explore-attr-breakdowns): Fixing eslint errors
8d6d577
Merge branch 'abdk/useChartXrangeSelection' into abdk/explore-attr-ne…
73d5e4b
feat(explore-attr-breakdowns): Fixing tests
c03426c
feat(charts): Addressing PR comments
bb4c733
Merge branch 'abdk/useChartXrangeSelection' into abdk/explore-attr-ne…
65fb51c
feat(explore-attrs-breakdown): Addressing PR suggestions
919b753
feat(explore-attrs-breakdown): Adding url persistence on absolute dat…
ea04bfd
feat(explore-attrs-breakdown): Iterating on functionality
499957d
feat(explore-attrs-breakdown): Iterating
a72ee28
feat(explore-attrs-breakdown): Iterating
8c898e4
feat(explore-attrs-breakdown): Fixing tests
423b520
feat(explore-attrs-breakdown): Resolving conflicts
1491b44
feat(explore-attrs-breakdown): Resolving conflicts
51114a0
feat(explore-attr-breakdowns): Persisting search
10e2130
feat(explore-attr-breakdowns): Adding new loading state UI (#103953)
Abdkhan14 4a273ec
feat(explore-attr-breakdowns): Resolving conflicts
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,7 +7,6 @@ import {ButtonBar} from '@sentry/scraps/button/buttonBar'; | |||||||||
| import {Flex} from '@sentry/scraps/layout'; | ||||||||||
|
|
||||||||||
| import LoadingError from 'sentry/components/loadingError'; | ||||||||||
| import LoadingIndicator from 'sentry/components/loadingIndicator'; | ||||||||||
| import Panel from 'sentry/components/panels/panel'; | ||||||||||
| import BaseSearchBar from 'sentry/components/searchBar'; | ||||||||||
| import {IconChevron} from 'sentry/icons/iconChevron'; | ||||||||||
|
|
@@ -16,6 +15,7 @@ import {space} from 'sentry/styles/space'; | |||||||||
| import type {NewQuery} from 'sentry/types/organization'; | ||||||||||
| import EventView from 'sentry/utils/discover/eventView'; | ||||||||||
| import {useApiQuery} from 'sentry/utils/queryClient'; | ||||||||||
| import {useQueryParamState} from 'sentry/utils/url/useQueryParamState'; | ||||||||||
| import {useDebouncedValue} from 'sentry/utils/useDebouncedValue'; | ||||||||||
| import {useLocation} from 'sentry/utils/useLocation'; | ||||||||||
| import useOrganization from 'sentry/utils/useOrganization'; | ||||||||||
|
|
@@ -37,7 +37,9 @@ export type AttributeDistribution = Array<{ | |||||||||
| }>; | ||||||||||
|
|
||||||||||
| export function AttributeDistribution() { | ||||||||||
| const [searchQuery, setSearchQuery] = useState(''); | ||||||||||
| const [searchQuery, setSearchQuery] = useQueryParamState({ | ||||||||||
| fieldName: 'attributeBreakdownsSearch', | ||||||||||
| }); | ||||||||||
| const [page, setPage] = useState(0); | ||||||||||
|
|
||||||||||
| const query = useQueryParamsQuery(); | ||||||||||
|
|
@@ -89,7 +91,7 @@ export function AttributeDistribution() { | |||||||||
|
|
||||||||||
| // Debouncing the search query here to ensure smooth typing, by delaying the re-mounts a little as the user types. | ||||||||||
| // query here to ensure smooth typing, by delaying the re-mounts a little as the user types. | ||||||||||
| const debouncedSearchQuery = useDebouncedValue(searchQuery, 100); | ||||||||||
| const debouncedSearchQuery = useDebouncedValue(searchQuery ?? '', 100); | ||||||||||
|
|
||||||||||
| const filteredAttributeDistribution: AttributeDistribution = useMemo(() => { | ||||||||||
| const attributeDistribution = | ||||||||||
|
|
@@ -137,76 +139,74 @@ export function AttributeDistribution() { | |||||||||
| setPage(0); | ||||||||||
| }, [filteredAttributeDistribution]); | ||||||||||
|
|
||||||||||
| if (isAttributeBreakdownsError || isCohortCountError) { | ||||||||||
| return <LoadingError message={t('Failed to load attribute breakdowns')} />; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| return ( | ||||||||||
| <Panel> | ||||||||||
| <Flex direction="column" gap="xl" padding="xl"> | ||||||||||
| {isAttributeBreakdownsLoading || isCohortCountLoading ? ( | ||||||||||
| <LoadingIndicator /> | ||||||||||
| ) : isAttributeBreakdownsError || isCohortCountError ? ( | ||||||||||
| <LoadingError message={t('Failed to load attribute breakdowns')} /> | ||||||||||
| ) : ( | ||||||||||
| <Fragment> | ||||||||||
| <ControlsContainer> | ||||||||||
| <StyledBaseSearchBar | ||||||||||
| placeholder={t('Search keys')} | ||||||||||
| onChange={q => { | ||||||||||
| setSearchQuery(q); | ||||||||||
| }} | ||||||||||
| query={debouncedSearchQuery} | ||||||||||
| size="sm" | ||||||||||
| /> | ||||||||||
| <AttributeBreakdownsComponent.FeedbackButton /> | ||||||||||
| </ControlsContainer> | ||||||||||
| {filteredAttributeDistribution.length > 0 ? ( | ||||||||||
| <Fragment> | ||||||||||
| <ChartsGrid> | ||||||||||
| {filteredAttributeDistribution | ||||||||||
| .slice(page * CHARTS_PER_PAGE, (page + 1) * CHARTS_PER_PAGE) | ||||||||||
| .map(attribute => ( | ||||||||||
| <Chart | ||||||||||
| key={attribute.name} | ||||||||||
| attributeDistribution={attribute} | ||||||||||
| cohortCount={cohortCount} | ||||||||||
| theme={theme} | ||||||||||
| /> | ||||||||||
| ))} | ||||||||||
| </ChartsGrid> | ||||||||||
| <PaginationContainer> | ||||||||||
| <ButtonBar merged gap="0"> | ||||||||||
| <Button | ||||||||||
| icon={<IconChevron direction="left" />} | ||||||||||
| aria-label={t('Previous')} | ||||||||||
| size="sm" | ||||||||||
| disabled={page === 0} | ||||||||||
| onClick={() => { | ||||||||||
| setPage(page - 1); | ||||||||||
| }} | ||||||||||
| /> | ||||||||||
| <Button | ||||||||||
| icon={<IconChevron direction="right" />} | ||||||||||
| aria-label={t('Next')} | ||||||||||
| size="sm" | ||||||||||
| disabled={ | ||||||||||
| page === | ||||||||||
| Math.ceil( | ||||||||||
| (filteredAttributeDistribution?.length ?? 0) / CHARTS_PER_PAGE | ||||||||||
| ) - | ||||||||||
| 1 | ||||||||||
| } | ||||||||||
| onClick={() => { | ||||||||||
| setPage(page + 1); | ||||||||||
| }} | ||||||||||
| <Fragment> | ||||||||||
| <ControlsContainer> | ||||||||||
| <StyledBaseSearchBar | ||||||||||
| placeholder={t('Search keys')} | ||||||||||
| onChange={q => { | ||||||||||
| setSearchQuery(q); | ||||||||||
| }} | ||||||||||
|
Comment on lines
+153
to
+155
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| query={debouncedSearchQuery} | ||||||||||
| size="sm" | ||||||||||
| /> | ||||||||||
| <AttributeBreakdownsComponent.FeedbackButton /> | ||||||||||
| </ControlsContainer> | ||||||||||
| {isAttributeBreakdownsLoading || isCohortCountLoading ? ( | ||||||||||
| <AttributeBreakdownsComponent.LoadingCharts /> | ||||||||||
| ) : filteredAttributeDistribution.length > 0 ? ( | ||||||||||
| <Fragment> | ||||||||||
| <ChartsGrid> | ||||||||||
| {filteredAttributeDistribution | ||||||||||
| .slice(page * CHARTS_PER_PAGE, (page + 1) * CHARTS_PER_PAGE) | ||||||||||
| .map(attribute => ( | ||||||||||
| <Chart | ||||||||||
| key={attribute.name} | ||||||||||
| attributeDistribution={attribute} | ||||||||||
| cohortCount={cohortCount} | ||||||||||
| theme={theme} | ||||||||||
| /> | ||||||||||
| </ButtonBar> | ||||||||||
| </PaginationContainer> | ||||||||||
| </Fragment> | ||||||||||
| ) : ( | ||||||||||
| <NoAttributesMessage> | ||||||||||
| {t('No matching attributes found')} | ||||||||||
| </NoAttributesMessage> | ||||||||||
| )} | ||||||||||
| </Fragment> | ||||||||||
| )} | ||||||||||
| ))} | ||||||||||
| </ChartsGrid> | ||||||||||
| <PaginationContainer> | ||||||||||
| <ButtonBar merged gap="0"> | ||||||||||
| <Button | ||||||||||
| icon={<IconChevron direction="left" />} | ||||||||||
| aria-label={t('Previous')} | ||||||||||
| size="sm" | ||||||||||
| disabled={page === 0} | ||||||||||
| onClick={() => { | ||||||||||
| setPage(page - 1); | ||||||||||
| }} | ||||||||||
| /> | ||||||||||
| <Button | ||||||||||
| icon={<IconChevron direction="right" />} | ||||||||||
| aria-label={t('Next')} | ||||||||||
| size="sm" | ||||||||||
| disabled={ | ||||||||||
| page === | ||||||||||
| Math.ceil( | ||||||||||
| (filteredAttributeDistribution?.length ?? 0) / CHARTS_PER_PAGE | ||||||||||
| ) - | ||||||||||
| 1 | ||||||||||
| } | ||||||||||
| onClick={() => { | ||||||||||
| setPage(page + 1); | ||||||||||
| }} | ||||||||||
| /> | ||||||||||
| </ButtonBar> | ||||||||||
| </PaginationContainer> | ||||||||||
| </Fragment> | ||||||||||
| ) : ( | ||||||||||
| <NoAttributesMessage>{t('No matching attributes found')}</NoAttributesMessage> | ||||||||||
| )} | ||||||||||
| </Fragment> | ||||||||||
| </Flex> | ||||||||||
| </Panel> | ||||||||||
| ); | ||||||||||
|
|
@@ -215,7 +215,6 @@ export function AttributeDistribution() { | |||||||||
| const ControlsContainer = styled('div')` | ||||||||||
| display: flex; | ||||||||||
| gap: ${space(0.5)}; | ||||||||||
| margin-bottom: ${space(1)}; | ||||||||||
| align-items: center; | ||||||||||
| `; | ||||||||||
|
|
||||||||||
|
|
||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Error rendering changed from wrapped to unwrapped
Error handling logic changed:
LoadingErrornow returns early withoutPanelandFlexwrappers that were present in the original implementation. Previously, errors displayed within the same container layout as normal content. This could cause visual inconsistency in how errors appear compared to the rest of the component layout and prior behavior.Additional Locations (1)
static/app/views/explore/components/attributeBreakdowns/cohortComparisonContent.tsx#L130-L133There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be working on the error state next