@@ -218,6 +218,15 @@ export class EntityKnexDataManager<
218218 /**
219219 * Load a page of objects using cursor-based pagination with unified pagination specification.
220220 *
221+ * @remarks
222+ *
223+ * This method implements cursor-based pagination using the seek method for efficient pagination even on large datasets
224+ * given appropriate indexes. Cursors are opaque and encode the necessary information to fetch the next page based on the
225+ * specified pagination strategy (standard, ILIKE search, or trigram search). For this implementation in particular,
226+ * the cursor encodes the ID of the last entity in the page to ensure correct pagination for all strategies, even in cases
227+ * where multiple rows have the same value for all fields other than the ID. If the entity referenced by a cursor has been
228+ * deleted, the load will return an empty page with `hasNextPage: false`.
229+ *
221230 * @param queryContext - query context in which to perform the load
222231 * @param args - pagination arguments including pagination and first/after or last/before
223232 * @returns connection with edges containing field objects and page info
@@ -477,6 +486,8 @@ export class EntityKnexDataManager<
477486 // We build a tuple comparison for fieldsToUseInPostgresTupleCursor fields of the
478487 // entity identified by the external cursor to ensure correct pagination behavior
479488 // even in cases where multiple rows have the same value all fields other than id.
489+ // If the cursor entity has been deleted, the subquery returns no rows and the
490+ // comparison evaluates to NULL, filtering out all results (empty page).
480491 const operator = direction === PaginationDirection . FORWARD ? '>' : '<' ;
481492
482493 const idField = getDatabaseFieldForEntityField (
@@ -555,7 +566,9 @@ export class EntityKnexDataManager<
555566 decodedExternalCursorEntityID : TFields [ TIDField ] ,
556567 direction : PaginationDirection ,
557568 ) : SQLFragment {
558- // For TRIGRAM search, we compute the similarity values using a subquery, similar to normal cursor
569+ // For TRIGRAM search, we compute the similarity values using a subquery, similar to normal cursor.
570+ // If the cursor entity has been deleted, the subquery returns no rows and the
571+ // comparison evaluates to NULL, filtering out all results (empty page).
559572 const operator = direction === PaginationDirection . FORWARD ? '<' : '>' ;
560573 const idField = getDatabaseFieldForEntityField (
561574 this . entityConfiguration ,
0 commit comments