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

[BUG] eq Filter Operation Used Instead of Custom filterOperator in Supabase Data Provider #6273

Closed
Ahamad17 opened this issue Aug 20, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Ahamad17
Copy link

Describe the bug

I have built an application using Refine and the Supabase data provider. When I attempt to perform a search operation, the filter operation is always set to eq (equals) in the request sent to the data provider and the router, despite specifying a different filterOperator in the column's meta property.

Steps To Reproduce

  1. Column Definition:

Below is the column definition I am using:

{ accessorKey: "name", header: ({ column }) => { return <DataTableColumnHeader column={column} title="Name" />; }, cell: ({ row }) => { return ( <div className="flex space-x-2"> <span className="max-w-[500px] truncate font-medium"> {row.getValue("name")} </span> </div> ); }, meta: { filterOperator: "contains", // Intended to use "contains" operation } }

  1. Input Field:
    Here's how I'm setting the filter value via an input field:

<Input placeholder="Filter students..." value={(table.getColumn("name")?.getFilterValue() as string) ?? ""} onChange={(event) => table.getColumn("name")?.setFilterValue(event.target.value) } className="h-8 w-[150px] lg:w-[250px]" />

Expected behavior

The search operation should use the contains filter operator as specified in the column's meta property.

Actual Behavior:
The filter operation is always sent as eq (equals) to the Supabase data provider and the router, ignoring the specified filterOperator.

Packages

"react": "^18.3.1",
"@refinedev/core": "^4.54.0",
"@refinedev/react-table": "^5.6.13",
"@refinedev/supabase": "^5.9.3",

Additional Context

This issue limits the ability to perform more flexible search operations, such as partial matching using contains, which is crucial for the search functionality in my application.

@Ahamad17 Ahamad17 added the bug Something isn't working label Aug 20, 2024
@Ahamad17
Copy link
Author

Go to know I need to add Id property to column without that filterOperator is not working.

{ id: "name", accessorKey: "name", header: ({ column }) => { return ( <DataTableColumnHeader column={column} title="Name" /> )}, cell: ({ row }) => { return ( <div className="flex space-x-2"> <span className="max-w-[500px] truncate font-medium"> {row.getValue("name")} </span> </div> ); }, meta: { filterOperator: "contains", }

  This worked for me. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant