onSearch in useSelect is not working with nested filter
I'm using supabase with antd and I cannot make it work to search inside !inner I get this error:
{
"code": "PGRST100",
"details": "unexpected "t" expecting "not" or operator (eq, gt, ...)",
"hint": null,
"message": ""failed to parse logic tree ((name.ilike.%ds%,product_item.title.ilike.%ds%))" (line 1, column 33)"
}
Payload:
select: ,product_item!inner(title)
account: eq.436ab251-7872-4ae3-a7fb-63ab0cd8291e
or: (name.ilike.%ds%,product_item.title.ilike.%ds%)
useSelect<{
id: number | string;
name: string;
description?: string;
phases?: IPhase[];
account: string;
product_item: any;
}>({
resource: "subscription_products",
meta: {
select: ", product_item!inner(title)",
},
filters: [
{
field: "account",
value: currentTeam?.account_id,
operator: "eq",
},
],
onSearch: (value) => [
{
operator: "or",
value: [
{
field: "name",
operator: "contains",
value: value,
},
{
field: "product_item.title",
operator: "contains",
value: value,
},
],
},
],
});
3 Replies
Hi @eno. 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 information provided in the knowledge sources, it appears that you're encountering an issue with nested filtering in Supabase when using the
useSelect
hook from refine. The error you're receiving suggests that there's a problem with the filter syntax being generated.
The issue seems to be related to how refine is handling the nested filters for Supabase. Unfortunately, the knowledge sources don't provide a direct solution to this specific problem. However, I can offer some insights and potential workarounds based on related information:
1. Supabase Realtime limitations: There's an ongoing issue with Supabase Realtime not supporting multiple filters. This might be indirectly related to your problem. Multiple Filters not Supported by Supabase Realtime
2. Filter syntax: The error message suggests that the filter syntax being generated is not correct for Supabase. The or
operator might not be properly handled for nested fields.
3. Potential workaround: You could try using the meta.select
property to include the nested field, and then filter on the client-side. This approach was mentioned as a workaround in a similar context. Multiple Filters not Supported by Supabase Realtime > Comments
4. Custom filter implementation: You might need to implement a custom filter function that correctly generates the Supabase-compatible filter syntax for nested fields.
5. Check for updates: Ensure you're using the latest version of @refinedev/supabase
, as there have been fixes for filter-related issues in the past. Wrong filter operators in refine-supabase
Given the complexity of your use case and the limitations in the current implementation, you might need to:
1. Simplify your filter to avoid nested fields if possible.
2. Implement client-side filtering for the nested fields.
3. Create a custom data provider that handles this specific case correctly.
If these workarounds don't solve your issue, I recommend reaching out to the refine community or creating a new issue on the refine GitHub repository with your specific use case. The developers might be able to provide a more tailored solution or consider implementing support for this scenario in future versions.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1075022730312826890> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
solid-orangeOP•3d ago
anyone that can help me with this