fix(web): bulk changes of more than 100 tickets go in batches
The list shows up to 200 tickets and «select all» picks them all, but the API takes 100 per bulk change: above that the whole change failed («At most 100 tickets at once») and nothing changed. The gateway now sends batches of 100 one after another and adds up the results, for the list and the backlog alike. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
BoardFilter,
|
||||
BulkChange,
|
||||
BulkResult,
|
||||
bulkBatches,
|
||||
ChangeStatusInput,
|
||||
CommandResult,
|
||||
CreateIssueInput,
|
||||
@@ -16,9 +17,10 @@ import {
|
||||
IssueSummary,
|
||||
LinkIssuesInput,
|
||||
MyIssuesFilter,
|
||||
mergeBulkResults,
|
||||
UpdateIssueInput,
|
||||
} from '@task-stream/web/tracker/domain';
|
||||
import { map, Observable } from 'rxjs';
|
||||
import { concatMap, from, map, Observable, toArray } from 'rxjs';
|
||||
import {
|
||||
AddChecklistItemDocument,
|
||||
AssignIssueDocument,
|
||||
@@ -288,7 +290,19 @@ export class GraphqlIssuesGateway extends IssuesGateway {
|
||||
.pipe(map((d) => d.trash.map(toIssueSummary)));
|
||||
}
|
||||
|
||||
/** In batches of what the API takes, one after another, added up. */
|
||||
bulkUpdate(issueIds: string[], change: BulkChange): Observable<BulkResult> {
|
||||
return from(bulkBatches(issueIds)).pipe(
|
||||
concatMap((batch) => this.bulkBatch(batch, change)),
|
||||
toArray(),
|
||||
map(mergeBulkResults),
|
||||
);
|
||||
}
|
||||
|
||||
private bulkBatch(
|
||||
issueIds: string[],
|
||||
change: BulkChange,
|
||||
): Observable<BulkResult> {
|
||||
return this.gql
|
||||
.mutate(BulkUpdateIssuesDocument, {
|
||||
input: {
|
||||
|
||||
Reference in New Issue
Block a user