Next.js Discord

Discord Forum

Realtime database is not working

Answered
Havana posted this in #help-forum
Open in Discord
HavanaOP
Hello, I have a problem implementing the realtime to my posts table in supabase.

I have followed this [video](https://youtu.be/6Sb8R1PYhTY) and everything is ok until I test it I got the message in the logs in the uploaded image but the UI is not changing for some reason.
Answered by Havana
The issue seems to be related to realtime updates not reflecting in the application until a manual page refresh. This is likely because the state is not being updated when a realtime event occurs.
View full answer

3 Replies

HavanaOP
# src\app\(Home)\page.tsx
This is the home file where I did the subscribing.
Here's message logged in the image above:
{
    "schema": "public",
    "table": "Posts",
    "commit_timestamp": "2024-03-10T10:30:06.826Z",
    "eventType": "INSERT",
    "new": {
        "created_at": "2024-03-10T10:30:06.824023+00:00",
        "description": "asd",
        "districts": "asd",
        "id": 18,
        "phone": "asd",
        "price": "asd",
        "publisher": null,
        "region": "asd",
        "title": "asd"
    },
    "old": {},
    "errors": null
}
HavanaOP
The issue seems to be related to realtime updates not reflecting in the application until a manual page refresh. This is likely because the state is not being updated when a realtime event occurs.
Answer