Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As soon as we include the record count, JSON API applies filters twice #195

Open
rpbaltazar opened this issue Dec 19, 2019 · 1 comment
Open

Comments

@rpbaltazar
Copy link
Contributor

JSONAPI.configure do |config|
          # http://jsonapi-resources.com/v0.9/guide/resource_caching.html
          config.resource_cache = Rails.cache
          #:underscored_key, :camelized_key, :dasherized_key, or custom
          config.json_key_format = :underscored_key
          #:underscored_route, :camelized_route, :dasherized_route, or custom
          config.route_format = :underscored_route

          config.default_paginator = :none
          # config.default_page_size = 10
          # config.maximum_page_size = 20
          config.top_level_meta_include_record_count = true
          config.top_level_meta_record_count_key = :record_count
          # config.top_level_meta_include_page_count = true
          # config.top_level_meta_page_count_key = :page_count
        end
@rpbaltazar
Copy link
Contributor Author

This is a potential issue with JSON API itself but needs further investigation.
I'd understand if pagination was on and we needed to get the whole record count, but not with pagination off as it seems to be the case.

To reproduce the problem, just make a request spec that asks for filters and in one of the filter blocks get a binding.pry. it'll be triggered twice for a single request.

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

No branches or pull requests

1 participant