Skip to content

filter_query array brackets get encoded #32

Description

@coltmans

Describe the issue you're facing

Hey, we are using your version 3.0.15 at the moment.
I want to filter stories by a date field endtime in a block. Following you docs I should be able to filter, but I get no stories at all.

We are using the .get() method of the getStoryblokApi from you react sdk.
What I see in the network tab, the request url has encoded array brackets for the filter_query: &filter_query%5Benddate%5D%5Bgt_date%5D=2025-05-05%2015%3A41

Image

Changing the request url with non encoded brackets, it's working. &filter_query[enddate][lt_date]=2025-05-05%2015%3A41

Image

That's basically the code:

const response: ISbStories = await getStoryblokApi().get(`cdn/stories/`, {
      ...sbParams,
      content_type: contentType,
      starts_with: country,
      sort_by: 'published_at:desc',
      filter_query: {
        enddate: { lt_date: `${year}-${month}-${day} ${hours}:${minutes}` },
      },
    });

Reproduction

I don't have one atm

Steps to reproduce

No response

System Info

System:
    OS: macOS 15.4.1
    CPU: (12) arm64 Apple M3 Pro
    Memory: 66.64 MB / 18.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.11.0 - ~/.nvm/versions/node/v22.11.0/bin/node
    npm: 11.2.0 - ~/.nvm/versions/node/v22.11.0/bin/npm
    pnpm: 9.15.1 - /opt/homebrew/bin/pnpm
    bun: 1.1.24 - ~/.bun/bin/bun
  Browsers:
    Chrome: 135.0.7049.116
    Edge: 136.0.3240.50
    Safari: 18.4

Used Package Manager

npm

Error logs (Optional)

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions