Skip to content
Closed
Show file tree
Hide file tree
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
19 changes: 4 additions & 15 deletions static/app/actionCreators/group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,7 @@ export async function bulkUpdate(

type MergeGroupsParams = UpdateParams;

export async function mergeGroups(
api: Client,
params: MergeGroupsParams,
options: RequestCallbacks = {}
) {
export async function mergeGroups(api: Client, params: MergeGroupsParams): Promise<any> {
const {itemIds} = params;
const path = getUpdateUrl(params);

Expand All @@ -175,25 +171,18 @@ export async function mergeGroups(

GroupStore.onMerge(id, itemIds);

let responseMeta: any;
let statusText: string | undefined;

try {
const [response, status, meta] = await api.requestPromise(path, {
const [response] = await api.requestPromise(path, {
query,
method: 'PUT',
data: {merge: 1},
includeAllArgs: true,
});
statusText = status;
responseMeta = meta;
GroupStore.onMergeSuccess(id, itemIds, response);
options?.success?.(response, statusText, responseMeta);
return response;
} catch (error) {
GroupStore.onMergeError(id, itemIds, error);
options?.error?.(error);
} finally {
options?.complete?.(responseMeta, statusText ?? '');
throw error;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,11 @@ export function SimilarStackTrace({project}: Props) {
{ids: string[]; projectSlug: string; query?: string}
>({
mutationFn: ({ids, projectSlug, query}) =>
new Promise((resolve, reject) => {
mergeGroups(
api,
{
orgId: organization.slug,
projectId: projectSlug,
itemIds: [...ids, params.groupId],
query,
},
{
success: (data: any) => resolve(data),
error: (err: any) =>
reject(err instanceof Error ? err : new Error('Failed to merge issues')),
}
);
mergeGroups(api, {
orgId: organization.slug,
projectId: projectSlug,
itemIds: [...ids, params.groupId],
query,
}),
onSuccess: data => {
if (data?.merge?.parent && data.merge.parent !== params.groupId) {
Expand Down
20 changes: 8 additions & 12 deletions static/app/views/issueList/actions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,18 +223,14 @@ export function IssueListActions({

function handleMerge() {
actionSelectedGroups(itemIds => {
mergeGroups(
api,
{
orgId: organization.slug,
itemIds,
query: queryExcludingPerformanceIssues,
project: selection.projects,
environment: selection.environments,
...selection.datetime,
},
{}
);
mergeGroups(api, {
orgId: organization.slug,
itemIds,
query: queryExcludingPerformanceIssues,
project: selection.projects,
environment: selection.environments,
...selection.datetime,
}).catch(() => {});
if (selection.projects[0]) {
const trackProject = ProjectsStore.getById(`${selection.projects[0]}`);
trackAnalytics('issues_stream.merged', {
Expand Down
Loading