1- import { Fragment , useCallback , useEffect , useMemo } from 'react' ;
1+ import { Fragment , useEffect , useMemo } from 'react' ;
22import { css } from '@emotion/react' ;
33import styled from '@emotion/styled' ;
44
@@ -22,7 +22,6 @@ import type {Project} from 'sentry/types/project';
2222import { defined } from 'sentry/utils' ;
2323import { DiscoverDatasets } from 'sentry/utils/discover/types' ;
2424import { useChartInterval } from 'sentry/utils/useChartInterval' ;
25- import { useLocalStorageState } from 'sentry/utils/useLocalStorageState' ;
2625import { useOrganization } from 'sentry/utils/useOrganization' ;
2726import { ChartSelectionProvider } from 'sentry/views/explore/components/attributeBreakdowns/chartSelectionContext' ;
2827import { OverChartButtonGroup } from 'sentry/views/explore/components/overChartButtonGroup' ;
@@ -34,6 +33,7 @@ import {
3433} from 'sentry/views/explore/components/styles' ;
3534import { Mode } from 'sentry/views/explore/contexts/pageParamsContext/mode' ;
3635import { useAnalytics } from 'sentry/views/explore/hooks/useAnalytics' ;
36+ import { useControlSectionExpanded } from 'sentry/views/explore/hooks/useControlSectionExpanded' ;
3737import { useCrossEventQueries } from 'sentry/views/explore/hooks/useCrossEventQueries' ;
3838import { useExploreAggregatesTable } from 'sentry/views/explore/hooks/useExploreAggregatesTable' ;
3939import { useExploreSpansTable } from 'sentry/views/explore/hooks/useExploreSpansTable' ;
@@ -90,30 +90,18 @@ export function SpansTabOnboarding({
9090 ) ;
9191}
9292
93- function useControlSectionExpanded ( ) {
94- const [ controlSectionExpanded , _setControlSectionExpanded ] = useLocalStorageState (
95- 'explore-spans-toolbar' ,
96- 'expanded'
97- ) ;
98-
99- const setControlSectionExpanded = useCallback (
100- ( expanded : boolean ) => {
101- _setControlSectionExpanded ( expanded ? 'expanded' : '' ) ;
102- } ,
103- [ _setControlSectionExpanded ]
104- ) ;
105-
106- return [ controlSectionExpanded === 'expanded' , setControlSectionExpanded ] as const ;
107- }
108-
10993interface SpanTabProps {
11094 datePageFilterProps : DatePageFilterProps ;
11195}
11296
97+ const SPANS_TOOLBAR_STORAGE_KEY = 'explore-spans-toolbar' ;
98+
11399export function SpansTabContent ( { datePageFilterProps} : SpanTabProps ) {
114100 useVisitExplore ( ) ;
115101
116- const [ controlSectionExpanded , setControlSectionExpanded ] = useControlSectionExpanded ( ) ;
102+ const [ controlSectionExpanded , setControlSectionExpanded ] = useControlSectionExpanded (
103+ SPANS_TOOLBAR_STORAGE_KEY
104+ ) ;
117105
118106 return (
119107 < Fragment >
@@ -365,7 +353,7 @@ const OnboardingContentSection = styled('section')`
365353 grid-column: 1/3;
366354` ;
367355
368- const ChevronButton = styled ( Button ) < { expanded : boolean } > `
356+ export const ChevronButton = styled ( Button ) < { expanded : boolean } > `
369357 display: none;
370358
371359 @media (min-width: ${ p => p . theme . breakpoints . md } ) {
0 commit comments