Add support for pagination with nested order by clause

Status
Completed
Assign
Date
Priority
Critical
Type
Task
Tags
product-blocking
feature
Avg estimate
Related tasks
Parent
Subtasks
Blocked By
Blocks
Property
When you create an API query with orderBy operator that targets a nested property — the nextPageToken in the response doesn’t work properly with subsequent page queries.
Example
  • Query Bankless podcast items, ordering them by publish date:
BanklessPodcastV1 {
      playlist: BanklessPodcastPodcastV1s(
          orderBy: {
            fieldPath: "snippet.publishedAt",
            direction: desc
          },
      		after: null,
      ) {
        pageInfo {
          hasNextPage
          nextPageToken
        }
        data {
          id
          contentDetails {
            videoId
            videoPublishedAt
          }
          snippet {
            publishedAt
            thumbnails {
              kind
              url
            }
            title
            description
          }
        }
      }
    }
 
  • Receive the first page + pagination info:
"BanklessPodcastV1": {
        "playlist": {
          "pageInfo": {
            "hasNextPage": true,
            "nextPageToken": "eyJfaWQiOiI2MWI5MDg4MDcyMThjOGE2NDZmOWYyZmMiLCJkaXIiOiJkZXNjIiwiY3VzdG9tIjp7ImZpZWxkUGF0aCI6ImRhdGEuc25pcHBldC5wdWJsaXNoZWRBdCIsInZhbHVlIjoidW5kZWZpbmVkIn19"
          },
          "data": [
            {
              "id": "UExta2RBZ3R4ZjNhaEVtTVdOWTUyQlgzdDFvN3ZiNGFONS44NjIxNjc5OUQwQkJBODQ5",
              "contentDetails": {
                "videoId": "N6AJlmB2h8k",
                "videoPublishedAt": 1642402745000
              },
						...
}
 
  • Use the nextPageToken to query the next page:
BanklessPodcastV1 {
      playlist: BanklessPodcastPodcastV1s(
          orderBy: {
            fieldPath: "snippet.publishedAt",
            direction: desc
          },
      		after: "eyJfaWQiOiI2MWI5MDg4MDcyMThjOGE2NDZmOWYyZmMiLCJkaXIiOiJkZXNjIiwiY3VzdG9tIjp7ImZpZWxkUGF0aCI6ImRhdGEuc25pcHBldC5wdWJsaXNoZWRBdCIsInZhbHVlIjoidW5kZWZpbmVkIn19",
      ) {
        pageInfo {
          hasNextPage
          nextPageToken
        }
        data {
          id
          contentDetails {
            videoId
            videoPublishedAt
          }
          snippet {
            publishedAt
            thumbnails {
              kind
              url
            }
            title
            description
          }
        }
      }
    }
 
This results in an empty page returned:
"BanklessPodcastV1": {
        "playlist": {
          "pageInfo": {
            "hasNextPage": false,
            "nextPageToken": null
          },
          "data": []
        }
      }
 
The bug doesn’t get reproduced if you paginate through data that’s ordered by top-level property e.g. id.

Add support for pagination with nested order by clause

Status
Completed
Assign
Date
Priority
Critical
Type
Task
Tags
product-blocking
feature
Avg estimate
Related tasks
Parent
Subtasks
Blocked By
Blocks
Property
When you create an API query with orderBy operator that targets a nested property — the nextPageToken in the response doesn’t work properly with subsequent page queries.
Example
  • Query Bankless podcast items, ordering them by publish date:
BanklessPodcastV1 {
      playlist: BanklessPodcastPodcastV1s(
          orderBy: {
            fieldPath: "snippet.publishedAt",
            direction: desc
          },
      		after: null,
      ) {
        pageInfo {
          hasNextPage
          nextPageToken
        }
        data {
          id
          contentDetails {
            videoId
            videoPublishedAt
          }
          snippet {
            publishedAt
            thumbnails {
              kind
              url
            }
            title
            description
          }
        }
      }
    }
 
  • Receive the first page + pagination info:
"BanklessPodcastV1": {
        "playlist": {
          "pageInfo": {
            "hasNextPage": true,
            "nextPageToken": "eyJfaWQiOiI2MWI5MDg4MDcyMThjOGE2NDZmOWYyZmMiLCJkaXIiOiJkZXNjIiwiY3VzdG9tIjp7ImZpZWxkUGF0aCI6ImRhdGEuc25pcHBldC5wdWJsaXNoZWRBdCIsInZhbHVlIjoidW5kZWZpbmVkIn19"
          },
          "data": [
            {
              "id": "UExta2RBZ3R4ZjNhaEVtTVdOWTUyQlgzdDFvN3ZiNGFONS44NjIxNjc5OUQwQkJBODQ5",
              "contentDetails": {
                "videoId": "N6AJlmB2h8k",
                "videoPublishedAt": 1642402745000
              },
						...
}
 
  • Use the nextPageToken to query the next page:
BanklessPodcastV1 {
      playlist: BanklessPodcastPodcastV1s(
          orderBy: {
            fieldPath: "snippet.publishedAt",
            direction: desc
          },
      		after: "eyJfaWQiOiI2MWI5MDg4MDcyMThjOGE2NDZmOWYyZmMiLCJkaXIiOiJkZXNjIiwiY3VzdG9tIjp7ImZpZWxkUGF0aCI6ImRhdGEuc25pcHBldC5wdWJsaXNoZWRBdCIsInZhbHVlIjoidW5kZWZpbmVkIn19",
      ) {
        pageInfo {
          hasNextPage
          nextPageToken
        }
        data {
          id
          contentDetails {
            videoId
            videoPublishedAt
          }
          snippet {
            publishedAt
            thumbnails {
              kind
              url
            }
            title
            description
          }
        }
      }
    }
 
This results in an empty page returned:
"BanklessPodcastV1": {
        "playlist": {
          "pageInfo": {
            "hasNextPage": false,
            "nextPageToken": null
          },
          "data": []
        }
      }
 
The bug doesn’t get reproduced if you paginate through data that’s ordered by top-level property e.g. id.