SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
feat: show related values section, always (#11032)
Ashwin Bhatkal5971a9efbf37
diff --git a/frontend/src/components/NewSelect/CustomMultiSelect.tsx b/frontend/src/components/NewSelect/CustomMultiSelect.tsxindex 6ca58b1b82..e7fcbb17c7 100644--- a/frontend/src/components/NewSelect/CustomMultiSelect.tsx+++ b/frontend/src/components/NewSelect/CustomMultiSelect.tsx@@ -1445,11 +1445,22 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({// Custom dropdown render with sections supportconst customDropdownRender = useCallback((): React.ReactElement => {- // Process options based on current search- const processedOptions =- selectedValues.length > 0 && isEmpty(searchText)- ? prioritizeOrAddOptionForMultiSelect(filteredOptions, selectedValues)- : filteredOptions;+ // When ALL is selected and the options contain sections (groups),+ // skip prioritization so section headers (e.g. "Related values" /+ // "All values") remain visible instead of being collapsed away by+ // every option getting hoisted to the top. For flat option lists we+ // still prioritize so selected/synthesized values stay rendered.+ const hasSections = filteredOptions.some(+ (opt) => 'options' in opt && Array.isArray(opt.options),+ );+ const shouldPrioritize =+ selectedValues.length > 0 &&+ isEmpty(searchText) &&+ !(hasSections && (allOptionShown || isAllSelected));++ const processedOptions = shouldPrioritize+ ? prioritizeOrAddOptionForMultiSelect(filteredOptions, selectedValues)+ : filteredOptions;const { sectionOptions, nonSectionOptions } = splitOptions(processedOptions);@@ -1747,6 +1758,8 @@ const CustomMultiSelect: React.FC<CustomMultiSelectProps> = ({}, [selectedValues,searchText,+ allOptionShown,+ isAllSelected,filteredOptions,splitOptions,isLabelPresent,diff --git a/frontend/src/components/NewSelect/__test__/CustomMultiSelect.test.tsx b/frontend/src/components/NewSelect/__test__/CustomMultiSelect.test.tsxindex 858f5a1cad..15ecaf47de 100644--- a/frontend/src/components/NewSelect/__test__/CustomMultiSelect.test.tsx+++ b/frontend/src/components/NewSelect/__test__/CustomMultiSelect.test.tsx@@ -6,6 +6,7 @@ import {screen,waitFor,} from '@testing-library/react';+import userEvent from '@testing-library/user-event';import CustomMultiSelect from '../CustomMultiSelect';@@ -283,4 +284,68 @@ describe('CustomMultiSelect Component', () => {// When all options are selected, component shows ALL tag insteadexpect(screen.getByText('ALL')).toBeInTheDocument();});++ describe('section visibility when ALL is selected', () => {+ it('keeps group headers visible when every grouped value is selected', async () => {+ const user = userEvent.setup();+ renderWithVirtuoso(+ <CustomMultiSelect+ options={mockGroupedOptions}+ value={['g1-option1', 'g1-option2', 'g2-option1', 'g2-option2']}+ />,+ );++ await user.click(screen.getByRole('combobox'));++ await waitFor(() => {+ expect(screen.getByText('Group 1')).toBeInTheDocument();+ expect(screen.getByText('Group 2')).toBeInTheDocument();+ });+ });++ it('keeps every grouped option visible within its section when all are selected', async () => {+ const user = userEvent.setup();+ renderWithVirtuoso(+ <CustomMultiSelect+ options={mockGroupedOptions}+ value={['g1-option1', 'g1-option2', 'g2-option1', 'g2-option2']}+ />,+ );++ await user.click(screen.getByRole('combobox'));++ await waitFor(() => {+ const group1Region = screen.getByRole('group', {+ name: 'Group 1 options',+ });+ const group2Region = screen.getByRole('group', {+ name: 'Group 2 options',+ });++ // Each option stays inside its original section rather than being+ // hoisted into a flat selected-first list.+ expect(group1Region).toHaveTextContent('Group 1 - Option 1');+ expect(group1Region).toHaveTextContent('Group 1 - Option 2');+ expect(group2Region).toHaveTextContent('Group 2 - Option 1');+ expect(group2Region).toHaveTextContent('Group 2 - Option 2');+ });+ });++ it('keeps group headers visible when value is the ALL sentinel', async () => {+ const user = userEvent.setup();+ renderWithVirtuoso(+ <CustomMultiSelect+ options={mockGroupedOptions}+ value={('__ALL__' as unknown) as string[]}+ />,+ );++ await user.click(screen.getByRole('combobox'));++ await waitFor(() => {+ expect(screen.getByText('Group 1')).toBeInTheDocument();+ expect(screen.getByText('Group 2')).toBeInTheDocument();+ });+ });+ });});