refinedev/refine

[FEAT] Deep Filtering on Nested JSON Fields in Supabase

Closed this issue · 2 comments

Is your feature request related to a problem? Please describe.

I'm currently working on a project using Refine with Supabase as the data provider. I have a use case where I need to filter data based on a nested JSON field. However, it seems that Refine does not support deep filtering on nested JSON fields out of the box.

Here's a snippet of my current implementation:

const {{ tableProps, searchFormProps }} = useTable({{
  onSearch: (values: any) => {{
    return [
      {{
        field: "data->>'spanish'",
        operator: "contains",
        value: values.value,
      }},
    ];
  }},
}});

where data is a JSONB field in Postgresql containing a key named spanish.

Describe alternatives you've considered

No response

Additional context

No response

Describe the thing to improve

allow filtering based on nested json.

Hey @LazerJesus could you elaborate more on the issue? It's not clear what's the issue. From your snippet, it seems like it should work. Do you get any error or empty response?

You can also swizzle the supabase data provider and modify it as needed as a quick workaround. https://refine.dev/docs/packages/cli/#commands

i had to change field: "data->>'spanish'" to field: "data->>spanish".