storyblok / storyblok-js-client

Universal JavaScript client for Storyblok's API
MIT License
128 stars 87 forks source link

No pagination for presets, components, component_groups, roles ? #535

Open marckraw opened 1 year ago

marckraw commented 1 year ago

When making request to get all presets, (through storyblok-js-client with url: spaces/${spaceId}/presets/ there is no total field in response and also nothing in headers.

Expected Behavior

Request should return total, and page field, and should be able to pass per_page and page into params. Example of proper pagination response, from for example datasources:

{
  data: { datasources: [ [Object], [Object], [Object], [Object], [Object] ] },
  headers: {
    'cache-control': 'max-age=0, private, must-revalidate',
    connection: 'keep-alive',
    'content-length': '913',
    'content-type': 'application/json; charset=utf-8',
    date: 'Sun, 16 Apr 2023 22:18:31 GMT',
    etag: 'W/"5fb942cd2c234891a887ee784e3dcc15"',
    'per-page': '100',
    'referrer-policy': 'strict-origin-when-cross-origin',
    server: 'nginx/1.23.3',
    total: '5',
    vary: 'Origin',
    via: '1.1 8455bcb2c0203b0c4ee93b610d75e69a.cloudfront.net (CloudFront)',
    'x-amz-cf-id': 'fWwK-6-2_dhXza2Ke7dDxIx6fBHDFXn0Xua0bwDvYkbu-1FRVSE5mg==',
    'x-amz-cf-pop': 'ZRH50-C1',
    'x-cache': 'Miss from cloudfront',
    'x-content-type-options': 'nosniff',
    'x-download-options': 'noopen',
    'x-frame-options': 'SAMEORIGIN',
    'x-permitted-cross-domain-policies': 'none',
    'x-request-id': 'baecb3f0-4de9-4166-81aa-4e5153905807',
    'x-runtime': '0.061035',
    'x-xss-protection': '1; mode=block'
  },
  perPage: 100,
  total: 5
}
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Total pages:  1

Current Behavior

It doesnt return total and page fields, also not in headers:

{
  data: { presets: [ [Object] ] },
  headers: {
    'cache-control': 'max-age=0, private, must-revalidate',
    connection: 'keep-alive',
    'content-encoding': 'gzip',
    'content-type': 'application/json; charset=utf-8',
    date: 'Sun, 16 Apr 2023 21:47:40 GMT',
    etag: 'W/"d0f8241a16fa6bcc50a3c7fd357d12e4"',
    'referrer-policy': 'strict-origin-when-cross-origin',
    server: 'nginx/1.23.3',
    'transfer-encoding': 'chunked',
    vary: 'Accept-Encoding, Origin',
    via: '1.1 ebbd7f31e48ea8cf77f6021cdd92bf62.cloudfront.net (CloudFront)',
    'x-amz-cf-id': 'tcoxa6aZSyvB-QjHcMe6R1_cfSq8s8a4p7c0KGjI39EcIWrL8SD2Qw==',
    'x-amz-cf-pop': 'ZRH50-C1',
    'x-cache': 'Miss from cloudfront',
    'x-content-type-options': 'nosniff',
    'x-download-options': 'noopen',
    'x-frame-options': 'SAMEORIGIN',
    'x-permitted-cross-domain-policies': 'none',
    'x-request-id': '4d148cb1-48ce-456a-86f9-a3ec55690b98',
    'x-runtime': '0.016675',
    'x-xss-protection': '1; mode=block'
  }
}

Steps to Reproduce

Just make request using storyblok-js-client@^5.10.2

marckraw commented 1 year ago

PS. same is happening for roles endpoint...

spaces/${spaceId}/space_roles/
{
  data: { space_roles: [ [Object] ] },
  headers: {
    'cache-control': 'max-age=0, private, must-revalidate',
    connection: 'keep-alive',
    'content-length': '313',
    'content-type': 'application/json; charset=utf-8',
    date: 'Sun, 16 Apr 2023 22:03:24 GMT',
    etag: 'W/"8d36361687ba4eb4873039f586f0e1a9"',
    'referrer-policy': 'strict-origin-when-cross-origin',
    server: 'nginx/1.23.3',
    vary: 'Origin',
    via: '1.1 9349ae4f82564896b96f5303b030d188.cloudfront.net (CloudFront)',
    'x-amz-cf-id': 'wKzeI0hqxrPQxrI4NA-U9xK1une_oDoFq2aA9zKYs8dkOhrCXDP3dA==',
    'x-amz-cf-pop': 'ZRH50-C1',
    'x-cache': 'Miss from cloudfront',
    'x-content-type-options': 'nosniff',
    'x-download-options': 'noopen',
    'x-frame-options': 'SAMEORIGIN',
    'x-permitted-cross-domain-policies': 'none',
    'x-request-id': 'e455ef36-6d77-4201-a5e6-d41d44254a07',
    'x-runtime': '0.030316',
    'x-xss-protection': '1; mode=block'
  }
}
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Total pages:  NaN
marckraw commented 1 year ago

eeeee end same for component_groups :)

spaces/${spaceId}/component_groups/
{
  data: {
    component_groups: [ [Object], [Object], [Object], [Object], [Object] ]
  },
  headers: {
    'cache-control': 'max-age=0, private, must-revalidate',
    connection: 'keep-alive',
    'content-length': '433',
    'content-type': 'application/json; charset=utf-8',
    date: 'Sun, 16 Apr 2023 22:16:14 GMT',
    etag: 'W/"7bd9f381ab8e3a1bfd2d1fac6ac9498a"',
    'referrer-policy': 'strict-origin-when-cross-origin',
    server: 'nginx/1.23.3',
    vary: 'Origin',
    via: '1.1 01ec1718bcc130455b377ec6b38ad50c.cloudfront.net (CloudFront)',
    'x-amz-cf-id': 'Z8icLvd4Wg0KgEyJtyfQ8YV4kP3ZralQd1X-nPlZCv_TNYGHV_Sn7A==',
    'x-amz-cf-pop': 'ZRH50-C1',
    'x-cache': 'Miss from cloudfront',
    'x-content-type-options': 'nosniff',
    'x-download-options': 'noopen',
    'x-frame-options': 'SAMEORIGIN',
    'x-permitted-cross-domain-policies': 'none',
    'x-request-id': '0100631a-1324-4b76-9329-1449297d9683',
    'x-runtime': '0.034203',
    'x-xss-protection': '1; mode=block'
  }
}
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Total pages:  NaN
marckraw commented 1 year ago

Same for all components:

spaces/${spaceId}/components/
{
  data: {
    components: [
      [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object], [Object],
      [Object], [Object], [Object], [Object]
    ],
    component_groups: [ [Object], [Object], [Object], [Object], [Object] ]
  },
  headers: {
    'cache-control': 'max-age=0, private, must-revalidate',
    connection: 'keep-alive',
    'content-length': '189311',
    'content-type': 'application/json; charset=utf-8',
    date: 'Sun, 16 Apr 2023 22:41:20 GMT',
    etag: 'W/"38f0c1b4b4972aa30e1176f337b9c236"',
    'referrer-policy': 'strict-origin-when-cross-origin',
    server: 'nginx/1.23.3',
    vary: 'Origin',
    via: '1.1 a4f3f56409fe4e0b42683dc15dd52ef8.cloudfront.net (CloudFront)',
    'x-amz-cf-id': 'CUNmGEm7K_RRu6Yk3a_zXD2kxPrIs6qlPMHthj11uMtbbpFbgMvxLQ==',
    'x-amz-cf-pop': 'ZRH50-C1',
    'x-cache': 'Miss from cloudfront',
    'x-content-type-options': 'nosniff',
    'x-download-options': 'noopen',
    'x-frame-options': 'SAMEORIGIN',
    'x-permitted-cross-domain-policies': 'none',
    'x-request-id': '1658ebad-3be6-4f16-9434-43ec69a14e82',
    'x-runtime': '0.094123',
    'x-xss-protection': '1; mode=block'
  }
}
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Total pages:  NaN
marckraw commented 1 year ago

Any update on the pagination issue ? :)

thiagosaife commented 1 year ago

@marckraw We'll tackle this one.

marckraw commented 1 year ago

@thiagosaife super cool, thank you 🙏

alvarosabu commented 2 months ago

Hi @marckraw can you please confirm for me if this is still an issue? Thanks

marckraw commented 2 months ago

Hi @marckraw can you please confirm for me if this is still an issue? Thanks

will try to find some time, this/next week to do proper testing - sb-mig is waiting to be updated with new storyblok-js-client for long time ;p

alvarosabu commented 2 months ago

@marckraw Let me know 🙏🏻