Skip to content

fix(replays): stop polling bulk delete jobs that are not running - #120773

Open
JoshuaKGoldberg wants to merge 1 commit into
masterfrom
joshgoldberg/replay-951-bulk-delete-polling-frontend
Open

fix(replays): stop polling bulk delete jobs that are not running#120773
JoshuaKGoldberg wants to merge 1 commit into
masterfrom
joshgoldberg/replay-951-bulk-delete-polling-frontend

Conversation

@JoshuaKGoldberg

@JoshuaKGoldberg JoshuaKGoldberg commented Jul 28, 2026

Copy link
Copy Markdown
Member

Frontend half of the bulk replay delete report. Backend changes are in #120772.

This has three general areas fixed:

  • Endless polling: replayBulkDeleteAuditLogApiOptions set refetchInterval: 1_000 unconditionally, so the Bulk Delete settings tab requested the endpoint once a second for as long as it stayed open, whether or not any job was running.
  • Tab visibility: Bulk Delete always was rendered in project settings, even though you can't use it without project:write/project:admin. That's a recipe for 403s.
  • Alert visibility: useShouldRenderBulkDeleteAlert derived its return value from a useRef (aside: this is why AIs defaulting to so many refs irks me!), so the in-progress banner on the replay list did not appear or disappear until some unrelated re-render happened.

Part of #120413.

The audit log refetched every second unconditionally, so the settings tab kept requesting the endpoint indefinitely even when every job had already finished. Locally that is 26 requests in 47 seconds against a project whose jobs were all completed. Polling is now driven by the data: 5s while a job is pending or in-progress, and off otherwise.

The Bulk Delete tab and its panel rendered for anyone who could reach project settings, so a member without project:write saw the feature and the request went out on their behalf. Both are now gated on project:write or project:admin, matching the endpoint, and the tab query param falls back to Replay Issues.

The in-progress banner on the replay list derived its visibility from a useRef, which is not reactive, so it did not appear or disappear until an unrelated re-render. It now derives from the query data.

Also adds the failed status the API can return to the job type.

Refs #120413
@linear-code

linear-code Bot commented Jul 28, 2026

Copy link
Copy Markdown

REPLAY-951

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 28, 2026
@JoshuaKGoldberg

Copy link
Copy Markdown
Member Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit fe8001a. Configure here.

rangeEnd: string;
rangeStart: string;
status: 'pending' | 'in-progress' | 'completed';
status: 'pending' | 'in-progress' | 'completed' | 'failed';

@JoshuaKGoldberg JoshuaKGoldberg Jul 28, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

[Explanation] 'failed' isn't actually needed for this PR, it's just a missing type that the server can send back. I figured I'd lump it in. See also #120772.

@JoshuaKGoldberg JoshuaKGoldberg changed the title fix(replays): Stop polling bulk delete jobs that are not running fix(replays): stop polling bulk delete jobs that are not running Jul 28, 2026
@JoshuaKGoldberg
JoshuaKGoldberg marked this pull request as ready for review July 28, 2026 20:28
@JoshuaKGoldberg
JoshuaKGoldberg requested review from a team as code owners July 28, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant