import {Fragment} from 'react'; import LoadingError from 'sentry/components/loadingError'; import LoadingIndicator from 'sentry/components/loadingIndicator'; import Pagination from 'sentry/components/pagination'; import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle'; import {t} from 'sentry/locale'; import {Repository} from 'sentry/types'; import {setApiQueryData, useApiQuery, useQueryClient} from 'sentry/utils/queryClient'; import routeTitleGen from 'sentry/utils/routeTitle'; import {useLocation} from 'sentry/utils/useLocation'; import useOrganization from 'sentry/utils/useOrganization'; import OrganizationRepositories from './organizationRepositories'; function OrganizationRepositoriesContainer() { const organization = useOrganization(); const location = useLocation(); const queryClient = useQueryClient(); const { data: itemList, isLoading, isError, getResponseHeader, } = useApiQuery( [`/organizations/${organization.slug}/repos/`, {query: location.query}], {staleTime: 0} ); const itemListPageLinks = getResponseHeader?.('Link'); if (isLoading) { return ; } if (isError) { return ; } // Callback used by child component to signal state change function onRepositoryChange(data: Pick) { setApiQueryData( queryClient, [`/organizations/${organization.slug}/repos/`, {query: location.query}], oldItemList => oldItemList.map(item => item.id === data.id ? {...item, status: data.status} : item ) ); } return ( {itemListPageLinks && } ); } export default OrganizationRepositoriesContainer;