Supabase filtering and realtime(live) filtering
Im using refine with supabase i have messages that should update in realtime on the admin panel. Im using liveProvider for realtime.
message table has from_id and to_id fields
const messages = useList({
resource: "message",
liveMode: "auto",
sorters: [{ field: "created_at", order: "asc" }],
pagination: {
pageSize: 100,
},
})
this is my list
I want to filter the messages so i get messages where:
from_id equeals to senderId or recieverId
or to_id equeals to senderId or recieverId
senderId and recieverId are the params i pass
the problem is when i add
filters: [
{
operator: "or",
value: [
{
field: "from_id",
operator: "in",
value:
},
{
field: "to_id",
operator: "in",
value:
},
],
},
],
it works fine for getting the list of messages but does not work for liveprovider (subscription for the event can't be created)
so how do i do it?
message table has from_id and to_id fields
const messages = useList({
resource: "message",
liveMode: "auto",
sorters: [{ field: "created_at", order: "asc" }],
pagination: {
pageSize: 100,
},
})
this is my list
I want to filter the messages so i get messages where:
from_id equeals to senderId or recieverId
or to_id equeals to senderId or recieverId
senderId and recieverId are the params i pass
the problem is when i add
filters: [
{
operator: "or",
value: [
{
field: "from_id",
operator: "in",
value:
(${userId},${env.BOT_ID}),},
{
field: "to_id",
operator: "in",
value:
(${userId},${env.BOT_ID}),},
],
},
],
it works fine for getting the list of messages but does not work for liveprovider (subscription for the event can't be created)
so how do i do it?
