Subscribe to Authenticated Realtime Events with Client Components and the Next.js 13 App Router

  Рет қаралды 12,392

Supabase

Supabase

Күн бұрын

Пікірлер: 33
@OmarAfet
@OmarAfet 9 ай бұрын
It's worth mentioning that in the callback function, you can use the received payload for faster performance instead of refreshing the entire data, as explained at 4:55
@josephmdev
@josephmdev 8 ай бұрын
Would the Supabase team consider going through these videos and marking them as outdated? Or.... something to the effect of what is stated in the docs: "We generally recommend using the new @supabase/ssr package instead of auth-helpers. @supabase/ssr takes the core concepts of the Auth Helpers package and makes them available to any server framework." I'm developing with Next.js and Supabase and living in a sad world where so many of the resources put out by Next.js are related to pages router and resources put out by Supabase (like this one) are already semi-deprecated. Would be really nice if I could filter these out or at least identify them immediately.
@dabisrat
@dabisrat 9 ай бұрын
I've noticed it takes a while for the client to subscribe to a channel that is connected to an RSL table. Is there an example of using real-time in a server component?
@wtf-is-this-974
@wtf-is-this-974 6 ай бұрын
realtime makes no sense in server component
@ashron4472
@ashron4472 Жыл бұрын
Now i understand, this realtime.. cheers man🎉
@JonMeyers
@JonMeyers Жыл бұрын
Excellent! Glad it helped! 🙌
@Supabase
@Supabase Жыл бұрын
He is a great teacher! 💯
@carlotubigon8763
@carlotubigon8763 9 ай бұрын
Can it be used in server components?
@dkras
@dkras Жыл бұрын
How would u get the current logged in user inside a client component? For example, I need to fetch some data on client but it requires me to pass the current user id
@unrelentingpest
@unrelentingpest Жыл бұрын
I've been doing this: const supabase = createClientComponentClient(); const user = await supabase.auth.getUser(); const id = user.data.user.id; I'm not sure if this is 100% correct, but it works for me
@JonMeyers
@JonMeyers Жыл бұрын
@@unrelentingpest Yep, this is the way to do it in a Client Component. If you need the `user` to be available on the first SSR render - you are rendering something different based on whether there is a user, for example - then it is better to fetch the user in an Async Server Component, and then pass it as a prop to the Client Component 👍
@Supabase
@Supabase Жыл бұрын
@@JonMeyers This is a good example of this pattern - Login (Server Component) fetches `session` and passes it as a prop to LoginForm (Client Component): github.com/supabase/supabase/blob/master/examples/auth/nextjs/app/login.tsx
@goodsamaritan208
@goodsamaritan208 Жыл бұрын
2:42 Don't we need to pass cookies object to createClient ComponentClient?
@youknowwho4994
@youknowwho4994 Жыл бұрын
In this particular case(subscribe realtime events), what will happens when the session expires?
@moosegoose1282
@moosegoose1282 Жыл бұрын
would really like to be able to run a custom function when an event hits and return it to the user
@JonMeyers
@JonMeyers Жыл бұрын
That's what we are doing here. The callback function you pass to the subscription can do whatever you like 👍
@moosegoose1282
@moosegoose1282 Жыл бұрын
@@JonMeyers but it also returns the data by supabse, what if i just want to be pinged and not expose sentive data until my backend cleans it?
@saeidmanhooei
@saeidmanhooei 11 ай бұрын
Is supabase designed to handle chat traffic like firebase for an app, lets say a flutter chat app? If so, is there a lib or some materials that recommends what implementation path to take?
@EloquentEpoch
@EloquentEpoch Жыл бұрын
I have a question. Does the realtime also work with React native, is the setup still the same as described?
@leandronorcio9642
@leandronorcio9642 Жыл бұрын
Hey, just a noob question. Does the channel name need to be unique per user?
@ficciones4737
@ficciones4737 Жыл бұрын
Hi everyone! I'm looking to sync state between tabs/sessions if they belong to the same account. How should I go about this with Supabase Realtime? Any tips? Has anyone implemented something similar?
@TheSlyNerdHour
@TheSlyNerdHour Жыл бұрын
So.. how do I do stuff with client components?
@YuraymarStewart-v2r
@YuraymarStewart-v2r Жыл бұрын
I am getting web socket failed message when trying this! Anyone found a fix?
@DezZolation
@DezZolation Жыл бұрын
Wouldn't it be more time/cost effective to not refresh the router but instead save the incoming todos in a state and mutate this state with the payload from the realtime channel? pros/cons? Thanks
@JonMeyers
@JonMeyers Жыл бұрын
Yep, definitely more performant to manually update the state but not necessary unless you have a highly dynamic app with lots of realtime events - a chat app, for example. There’s a link in the video description for updating this state manually 👍
@jotaroisdarius1918
@jotaroisdarius1918 Жыл бұрын
it's just because we're using server components and it's harder now to find a place to fit states
@horacinis
@horacinis Жыл бұрын
​@@JonMeyersthat works, but when you navigate away and come back, the data disappears and won't show untill you perform a refresh
@masonnash9396
@masonnash9396 Жыл бұрын
@@horacinis then you can setup a useEffect to fetch data initially. after that rely on the subscription to keep it up-to-date
@thomasmabika7291
@thomasmabika7291 Жыл бұрын
For the love of God, please allow realtime subscriptions from multiple tables.
@JonMeyers
@JonMeyers Жыл бұрын
For now you could set up multiple subscriptions 👍
@jordivandermeer601
@jordivandermeer601 Жыл бұрын
i need some more nuxt.js love ;)
Make your queries 43,240x faster
13:16
Supabase
Рет қаралды 27 М.
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 23 МЛН
Правильный подход к детям
00:18
Beatrise
Рет қаралды 9 МЛН
Call Postgres functions from JavaScript with RPC
15:36
Supabase
Рет қаралды 15 М.
Simplify complex SQL queries with Views in Postgres
26:01
Supabase
Рет қаралды 10 М.
Supabase + Next.js ULTIMATE Auth Combo
8:55
The Dev Logger
Рет қаралды 8 М.
Automate API requests with Database Webhooks in Supabase
14:52
10 common mistakes with the Next.js App Router
20:37
Vercel
Рет қаралды 233 М.
FASTEST way to build apps with Next.js 15
9:45
Supabase
Рет қаралды 11 М.
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 23 МЛН