Realtime is not working on React Project
yokowasis opened this issue · comments
Bug report
Describe the bug
The realtime listener doesn't get fired when using it on react project. Works fine on normal nodejs project.
To Reproduce
Expected behavior
The script is fired, and the react component state is changed.
@yokowasis doesn't look like you're running into this issue judging from the react version you're using in that codesandbox.
can you please submit a support ticket and include your supabase project ref? https://app.supabase.com/support/new
@yokowasis doesn't look like you're running into this issue judging from the react version you're using in that codesandbox.
can you please submit a support ticket and include your supabase project ref? https://app.supabase.com/support/new
Looks like I did. I modify my code to something like this, and it works, at least on localhost. Haven't tested it on production.
const first = useRef(true);
useEffect(() => {
if (first.current) {
first.current = false;
} else {
supabase
.from("datatest")
.on("*", (payload) => {
console.log(payload);
})
.subscribe();
}
})();
return () => {
console.log("DISMISS");
};
}, []);