diff --git a/static/app/views/issueList/pages/dynamicGrouping.tsx b/static/app/views/issueList/pages/dynamicGrouping.tsx index 72b6b4f62e41aa..5ee81f99cac7fd 100644 --- a/static/app/views/issueList/pages/dynamicGrouping.tsx +++ b/static/app/views/issueList/pages/dynamicGrouping.tsx @@ -1,6 +1,7 @@ import {Fragment, useCallback, useMemo, useState} from 'react'; import styled from '@emotion/styled'; +import {Tag} from '@sentry/scraps/badge'; import {Container, Flex} from '@sentry/scraps/layout'; import {Heading, Text} from '@sentry/scraps/text'; @@ -243,6 +244,13 @@ function ClusterCard({ )} )} + {cluster.tags && cluster.tags.length > 0 && ( + + {cluster.tags.map(tag => ( + {tag} + ))} + + )} {issueCount} @@ -346,6 +354,7 @@ function DynamicGrouping() { null ); const [jsonError, setJsonError] = useState(null); + const [disableFilters, setDisableFilters] = useState(false); // Fetch cluster data from API const {data: topIssuesResponse, isPending} = useApiQuery( @@ -377,6 +386,7 @@ function DynamicGrouping() { setCustomClusterData(null); setJsonInputValue(''); setJsonError(null); + setDisableFilters(false); }, []); const clusterData = customClusterData ?? topIssuesResponse?.data ?? []; @@ -419,32 +429,36 @@ function DynamicGrouping() { setRemovedClusterIds(prev => new Set([...prev, clusterId])); }; - const filteredAndSortedClusters = clusterData - .filter(cluster => { - if (removedClusterIds.has(cluster.cluster_id)) return false; - - const fixabilityScore = (cluster.fixability_score ?? 0) * 100; - if (fixabilityScore < minFixabilityScore) return false; - - if (filterByAssignedToMe) { - if (!cluster.assignedTo?.length) return false; - return cluster.assignedTo.some( - entity => - (entity.type === 'user' && entity.id === user.id) || - (entity.type === 'team' && userTeams.some(team => team.id === entity.id)) - ); - } - - if (isTeamFilterActive) { - if (!cluster.assignedTo?.length) return false; - return cluster.assignedTo.some( - entity => entity.type === 'team' && selectedTeamIds.has(entity.id) - ); - } - - return true; - }) - .sort((a, b) => (b.fixability_score ?? 0) - (a.fixability_score ?? 0)); + // When using custom JSON data with filters disabled, skip all filtering and sorting + const shouldSkipFilters = isUsingCustomData && disableFilters; + const filteredAndSortedClusters = shouldSkipFilters + ? clusterData.filter(cluster => !removedClusterIds.has(cluster.cluster_id)) + : clusterData + .filter(cluster => { + if (removedClusterIds.has(cluster.cluster_id)) return false; + + const fixabilityScore = (cluster.fixability_score ?? 0) * 100; + if (fixabilityScore < minFixabilityScore) return false; + + if (filterByAssignedToMe) { + if (!cluster.assignedTo?.length) return false; + return cluster.assignedTo.some( + entity => + (entity.type === 'user' && entity.id === user.id) || + (entity.type === 'team' && userTeams.some(team => team.id === entity.id)) + ); + } + + if (isTeamFilterActive) { + if (!cluster.assignedTo?.length) return false; + return cluster.assignedTo.some( + entity => entity.type === 'team' && selectedTeamIds.has(entity.id) + ); + } + + return true; + }) + .sort((a, b) => (b.fixability_score ?? 0) - (a.fixability_score ?? 0)); const totalIssues = filteredAndSortedClusters.flatMap(c => c.group_ids).length; @@ -506,6 +520,17 @@ function DynamicGrouping() { {jsonError} )} + + setDisableFilters(e.target.checked)} + aria-label={t('Disable filters and sorting')} + size="sm" + /> + + {t('Disable filters and sorting')} + +