Skip to content

Conversation

@dev-shahed
Copy link
Contributor

@dev-shahed dev-shahed commented Oct 14, 2025

🐛 Bug Identified

The issue was in sentry/static/app/stores/groupStore.tsx in the onDeleteSuccess method. When users selected "all in query" and deleted more than 25 issues, the notification showed "25 issues deleted" instead of the actual count because:

  1. When allInQuerySelected is true, itemIds is passed as undefined to bulkDelete
  2. The backend deletes all matching issues but returns 204 No Content with no count
  3. The frontend's onDeleteSuccess method called this.itemIdsOrAll(itemIds) which returned this.getAllItemIds() when itemIds was undefined
  4. getAllItemIds() only returned the IDs of issues currently loaded in the store (typically 25), not the actual number deleted

🔧 Fix Implemented

Modified the onDeleteSuccess method to handle the undefined case properly:

// Before: Always showed count based on loaded items (incorrect for "all in query")
if (ids.length > 1) {
  showAlert(t('Deleted %d Issues', ids.length), 'success');
} else {
  const shortId = ids.map(item => GroupStore.get(item)?.shortId).join('');
  showAlert(t('Deleted %s', shortId), 'success');
}

// After: Handle undefined case with generic message
if (itemIds === undefined) {
  showAlert(t('Deleted selected issues'), 'success');
} else if (ids.length > 1) {
  showAlert(t('Deleted %d Issues', ids.length), 'success');
} else {
  const shortId = ids.map(item => GroupStore.get(item)?.shortId).join('');
  showAlert(t('Deleted %s', shortId), 'success');
}

Expected Result

Now when users delete more than 25 issues using "Select all in query":

  • Before: "25 issues deleted" (incorrect count)
  • After: "Issues deleted" (generic but accurate message)

🧪 Tests Added

Added comprehensive tests to verify the fix:

  • Test for generic message when itemIds is undefined
  • Test for specific count when itemIds is provided
  • Test for single issue deletion with shortId

📁 Files Modified

  1. /home/shahed/Documents/sentry/static/app/stores/groupStore.tsx - Main fix
  2. /home/shahed/Documents/sentry/static/app/stores/groupStore.spec.tsx - Tests

Issue: #100277

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

- Fix incorrect count in deletion notification when 'all in query' is selected
- When itemIds is undefined (all in query), show generic 'Deleted all selected issues' message
- Previously showed count of loaded items (25) instead of actual deleted count
- Add comprehensive tests to verify the fix

Fixes issue where notification showed '25 issues deleted' when more than 25 issues were actually deleted from the backend.
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Oct 14, 2025
@dev-shahed
Copy link
Contributor Author

Hello Maintainers, @evanpurkhiser

I’ve submitted a Pull Request for this issue(#100277) as part of Hacktoberfest.
I’d really appreciate it if someone could take a moment to review it.
Thank you in advance!

- Changed notification message from 'Deleted all selected issues' to 'Deleted selected issues' for better accuracy.
- Updated corresponding test to reflect the new message.
@dev-shahed dev-shahed force-pushed the fix/issue-deletion-notification-count branch 2 times, most recently from 0dcd75d to d4d07c4 Compare October 14, 2025 19:18
@dev-shahed dev-shahed requested review from a team as code owners October 15, 2025 14:31
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 15, 2025
@github-actions
Copy link
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

@dev-shahed dev-shahed force-pushed the fix/issue-deletion-notification-count branch from 45841e5 to ec78bb9 Compare October 15, 2025 14:36
@armenzg armenzg added the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label Oct 15, 2025
Copy link
Member

@ryan953 ryan953 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

I'll merge this in. Thanks @dev-shahed !

@ryan953 ryan953 merged commit 873d0bb into getsentry:master Oct 15, 2025
45 of 47 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants