Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion static/app/views/releases/utils/useReleaseDeploys.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import {useEffect, useRef} from 'react';
import {logger} from '@sentry/react';

import type {Project} from 'sentry/types/project';
import type {Deploy} from 'sentry/types/release';
import {useApiQuery} from 'sentry/utils/queryClient';
import useOrganization from 'sentry/utils/useOrganization';
Expand All @@ -12,12 +16,24 @@ export function useReleaseDeploys({
}) {
const organization = useOrganization();
const project = useProjectFromSlug({organization, projectSlug});
const prevProject = useRef<Project | undefined>(undefined);

useEffect(() => {
if (!project) {
logger.warn('Release: project undefined in useReleaseDeploys', {projectSlug});
}
if (project && !prevProject.current) {
logger.warn('Release: project is now defined in useReleaseDeploys', {projectSlug});
}
prevProject.current = project;
}, [project, projectSlug]);

return useApiQuery<Deploy[]>(
[
`/organizations/${organization.slug}/releases/${encodeURIComponent(release)}/deploys/`,
{
query: {
project: project!.id, // Should be disabled if project is undefined
project: project?.id, // Should be disabled if project is undefined
},
},
],
Expand Down
Loading