Skip to content

Support cursor pagination for fetching requestIdentifiers#533

Open
anotherminh wants to merge 7 commits intomainfrom
anotherminh/cursor-pagination-requestIdentifiers
Open

Support cursor pagination for fetching requestIdentifiers#533
anotherminh wants to merge 7 commits intomainfrom
anotherminh/cursor-pagination-requestIdentifiers

Conversation

@anotherminh
Copy link
Contributor

Related Issues

Security Implications

[none]

System Availability

[none]

@anotherminh anotherminh requested review from a team and alexajury March 4, 2026 20:38
@linear
Copy link

linear bot commented Mar 4, 2026

input: {
requestIds: $requestIds
input: { requestIds: $requestIds }
filterBy: {
Copy link
Member

Choose a reason for hiding this comment

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

was this even working before with those values in input? 😅

offset += PAGE_SIZE;
shouldContinue = nodes.length === PAGE_SIZE;
} while (shouldContinue);
cursor = pageInfo.endCursor ?? undefined;
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think calling this var endCursor would be clearer.

Comment on lines +136 to +150
let requestsWithRequestIdentifiers: ExportedPrivacyRequest[];
if (skipRequestIdentifiers) {
requestsWithRequestIdentifiers = requests.map((request) => ({
...request,
requestIdentifiers: [] as RequestIdentifier[],
}));
} else {
const identifiersByRequest = await fetchRequestIdentifiersBatch(sombra, {
requestIds: requests.map((r) => r.id),
});
requestsWithRequestIdentifiers = requests.map((request) => ({
...request,
requestIdentifiers: identifiersByRequest.get(request.id) ?? [],
}));
}
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think this might be easier to read:

  const identifiersByRequest = skipRequestIdentifiers 
      ? new Map() 
      : await fetchRequestIdentifiersBatch(sombra, {
         requestIds: requests.map((r) => r.id),
        });
  
  const requestsWithRequestIdentifiers = requests.map((request) => ({
      ...request,
      requestIdentifiers: identifiersByRequest.get(request.id) ?? [],
    }));
  }

Comment on lines +196 to +212
let enriched: ExportedPrivacyRequest[];
if (skipRequestIdentifiers) {
enriched = nodes.map((n) => ({
...n,
requestIdentifiers: [],
}));
} else {
const identifiersByRequest =
await fetchRequestIdentifiersBatch(sombra!, {
requestIds: nodes.map((n) => n.id),
});
enriched = nodes.map((n) => ({
...n,
requestIdentifiers:
identifiersByRequest.get(n.id) ?? [],
}));
}
Copy link
Member

Choose a reason for hiding this comment

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

same suggestion for refactor here.

@iamtheluckyest iamtheluckyest requested a review from a team March 6, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants