import {RouteComponentProps} from 'react-router'; import {SavedSearch} from 'sentry/types'; import useOrganization from 'sentry/utils/useOrganization'; import {useFetchSavedSearchesForOrg} from 'sentry/views/issueList/queries/useFetchSavedSearchesForOrg'; import {useSelectedSavedSearch} from 'sentry/views/issueList/utils/useSelectedSavedSearch'; type InjectedSavedSearchesProps = { savedSearch: SavedSearch | null; savedSearchLoading: boolean; savedSearches: SavedSearch[]; } & RouteComponentProps<{searchId?: string}, {}>; /** * HOC to provide saved search data to class components. * When possible, use the hooks directly instead. */ function withSavedSearches

( WrappedComponent: React.ComponentType

) { return ( props: Omit & Partial ) => { const organization = useOrganization(); const {data: savedSearches, isLoading} = useFetchSavedSearchesForOrg({ orgSlug: organization.slug, }); const selectedSavedSearch = useSelectedSavedSearch(); return ( ); }; } export default withSavedSearches;