Skip to content

Commit d51cf6b

Browse files
scttcperclaude
andcommitted
fix(issues): Align handleDelete query key with fetch params
The optimistic delete was using a different query key than the fetch because handleDelete always passed statsPeriod/start/end, but after the previous fix those are only included when explicitly set in the URL. This caused the cache update to miss and the deleted attachment stayed visible. Also removes the stale statsPeriod: '14d' from the screenshot filter test expectation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 35ae0ee commit d51cf6b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

static/app/views/issueDetails/groupEventAttachments/groupEventAttachments.spec.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ describe('GroupEventAttachments', () => {
8484
query: {
8585
screenshot: '1',
8686
environment: [],
87-
statsPeriod: '14d',
8887
},
8988
})
9089
);

static/app/views/issueDetails/groupEventAttachments/groupEventAttachments.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ export function GroupEventAttachments({project, group}: GroupEventAttachmentsPro
7474

7575
const {mutate: deleteAttachment} = useDeleteGroupEventAttachment();
7676

77+
const hasSetStatsPeriod =
78+
location.query.statsPeriod || location.query.start || location.query.end;
79+
7780
const handleDelete = (attachment: IssueAttachment) => {
7881
deleteAttachment({
7982
attachment,
@@ -83,10 +86,12 @@ export function GroupEventAttachments({project, group}: GroupEventAttachmentsPro
8386
orgSlug: organization.slug,
8487
cursor: location.query.cursor as string | undefined,
8588
environment: eventView.environment as string[],
86-
start: eventView.start,
87-
end: eventView.end,
88-
statsPeriod: eventView.statsPeriod,
8989
eventQuery,
90+
...(hasSetStatsPeriod && {
91+
start: eventView.start,
92+
end: eventView.end,
93+
statsPeriod: eventView.statsPeriod,
94+
}),
9095
});
9196
};
9297

0 commit comments

Comments
 (0)