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
22 changes: 8 additions & 14 deletions static/app/views/dashboards/createFromSeer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import {LoadingIndicator} from 'sentry/components/loadingIndicator';
import {t} from 'sentry/locale';
import {parseQueryKey} from 'sentry/utils/api/apiQueryKey';
import {MarkedText} from 'sentry/utils/marked/markedText';
import {useApiQuery, useQueryClient} from 'sentry/utils/queryClient';
import {useApi} from 'sentry/utils/useApi';
import {fetchMutation, useApiQuery, useQueryClient} from 'sentry/utils/queryClient';
import {useLocation} from 'sentry/utils/useLocation';
import {useOrganization} from 'sentry/utils/useOrganization';
import type {SeerExplorerResponse} from 'sentry/views/seerExplorer/hooks/useSeerExplorer';
Expand Down Expand Up @@ -104,7 +103,6 @@ function extractMessages(
export default function CreateFromSeer() {
const organization = useOrganization();
const location = useLocation();
const api = useApi();
const queryClient = useQueryClient();

const seerRunId = location.query?.seerRunId ? Number(location.query.seerRunId) : null;
Expand Down Expand Up @@ -208,24 +206,20 @@ export default function CreateFromSeer() {
}
setisUpdating(true);
try {
const {url} = parseQueryKey(
makeSeerExplorerQueryKey(organization.slug, seerRunId)
);
await api.requestPromise(url, {
const queryKey = makeSeerExplorerQueryKey(organization.slug, seerRunId);
const {url} = parseQueryKey(queryKey);
await fetchMutation({
url,
method: 'POST',
data: {
query: message,
},
});
queryClient.invalidateQueries({
queryKey: makeSeerExplorerQueryKey(organization.slug, seerRunId),
data: {query: message},
});
queryClient.invalidateQueries({queryKey});
} catch {
setisUpdating(false);
addErrorMessage(t('Failed to send message'));
}
},
[api, organization.slug, queryClient, seerRunId]
[organization.slug, queryClient, seerRunId]
);

if (!hasFeature) {
Expand Down
Loading