Jesuscc9
07/20/2022, 2:49 AMjsx
const [listener, setListener] = useState()
useEffect(() => {
if (typeof metrics === 'undefined') return
if (typeof listener !== 'undefined') return
console.log('added listener')
setListener(
supabase
.from('metrics')
.on('INSERT', (payload) => {
alert('hola')
})
.subscribe((status) => {
console.log({ status }) // Prints "CLOSED" then "SUBSCRIBED" and finally "CLOSED" idk why
})
)
return () => {
supabase.removeSubscription(listener)
console.log('remove listener')
}
}, [metrics])
as you can see is, very simple, I already tried with a non state variable but still not working
BTW, in my realtime schema, in the subscriptions table I DO have the subscription