Logical filters "or" / "and" do not work with deep filtering

I am using supabase and antd design. I have a table where I want to filter foreign object with an OR filter but I get the error 'unexpected "z" expecting "not" or operator (eq, gt, ...)' '"failed to parse logic tree ((point_de_collecte.zone_de_collecte_id.eq.1))" (line 1, column 22)'
2 Replies
kapa.ai
kapa.ai7d ago
Hi @Benoît- L'INCASSABLE. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the knowledge sources provided, it appears that there are some issues with deep filtering and logical filters in refine when using Supabase. Let me address your question: The error you're encountering suggests that there might be a problem with how the filters are being parsed or constructed for Supabase. Deep filtering (filtering on related fields) and logical filters (OR/AND) can be tricky to implement correctly. Here are a few relevant points from the knowledge sources: 1. Deep filtering syntax: According to the Supabase documentation, deep filtering should use dot notation. For example:
filters: {
initial: [
{ field: "categories.title", operator: "eq", value: "Beginning" },
],
},
filters: {
initial: [
{ field: "categories.title", operator: "eq", value: "Beginning" },
],
},
2. Logical filters: The Handling Filters documentation shows that OR filters should be structured like this:
const filter = [
{
operator: "or",
value: [
{
field: "name",
operator: "eq",
value: "John Doe",
},
{
field: "age",
operator: "eq",
value: 30,
},
],
},
];
const filter = [
{
operator: "or",
value: [
{
field: "name",
operator: "eq",
value: "John Doe",
},
{
field: "age",
operator: "eq",
value: 30,
},
],
},
];
3. Known issues: There have been several issues reported regarding filters with Supabase, including: - Nested CrudFilters with Supabase not correctly mapped - Nested CrudFilters values with Supabase not correctly parsed These issues suggest that there might be ongoing problems with how filters are handled in the Supabase data provider for refine. To resolve your specific issue, you could try: 1. Ensure you're using the latest version of @refinedev/supabase. 2. Double-check your filter syntax to make sure it follows the correct structure for both deep filtering and OR conditions. 3. If the problem persists, you might need to use a workaround. For example, you could try using the meta property to pass custom SQL filters directly to Supabase. If none of these solutions work, you may want to report this as a new issue on the refine GitHub repository, as it could be a bug in the Supabase data provider that needs to be addressed by the refine team. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai7d ago
<@728572091149844530> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?