Skip to content

fix: jsonb filter path issue#172

Open
cjam wants to merge 1 commit intohasura:masterfrom
cjam:fix/jsonb-filter-fix
Open

fix: jsonb filter path issue#172
cjam wants to merge 1 commit intohasura:masterfrom
cjam:fix/jsonb-filter-fix

Conversation

@cjam
Copy link
Copy Markdown

@cjam cjam commented Nov 8, 2024

  • added logic to handed operation path within jsonb filters

- added logic to handed operation path within jsonb filters
@cjam
Copy link
Copy Markdown
Author

cjam commented Nov 8, 2024

As per the docs shown here: https://github.com/hasura/ra-data-hasura/tree/master?tab=readme-ov-file#jsonb-filtering

This PR fixes an issue with the filter reducer for JSONB that wasn't parsing or using the operation path. Now the example:

<TextField label="Theme Color" source="users#preferences@_contains@ux#theme" />```

Should produce the correct result:

```json
{
  "where": {
    "_and": [
      {
        "users": {
          "preferences": {
            "_contains": {
              "ux": {
                "theme": "%TEXT"
              }
            }
          }
        }
      }
    ]
  },
  "limit": 10,
  "offset": 0,
  "order_by": {
    "id": "asc"
  }
}

Ideally I would've broken it out to make it testable, but because it uses the introspection results I decided to just make minimal changes to the code and confirm it's functioning on my own project.

@cjam
Copy link
Copy Markdown
Author

cjam commented Nov 19, 2024

@praveenweb is anyone maintaining this library anymore? Who would be able to approve this?

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

Successfully merging this pull request may close these issues.

1 participant