Skip to content

Commit c9b4f89

Browse files
committed
Revert "Merge pull request #462 from supabase/feat/new-realtime-api"
This reverts commit bd03b65, reversing changes made to f37643c.
1 parent f5759a7 commit c9b4f89

File tree

12 files changed

+496
-292
lines changed

12 files changed

+496
-292
lines changed

example/next-storage/components/ProfileList.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
import ProfileCard from '../components/ProfileCard'
22
import { Profile } from '../lib/constants'
3+
import { Subscription, SupabaseRealtimePayload } from '@supabase/supabase-js'
34
import { supabase } from '../lib/api'
45
import { useState, useEffect } from 'react'
56

7+
var realtimeProfiles: Subscription | null = null
8+
69
export default function ProfileList() {
710
const [profiles, setProfiles] = useState<Profile[]>([])
811

912
useEffect(() => {
1013
// getPublicProfiles()
1114
getUserProfile()
1215

13-
const realtimeProfiles = supabase
14-
.channel('profiles-channel')
15-
.on(
16-
'postgres_changes',
17-
{ event: '*', schema: 'public', table: 'profiles' },
18-
(payload: { [key: string]: any }) => profileUpdated(profiles, payload.new)
19-
)
16+
realtimeProfiles = supabase
17+
.from('profiles')
18+
.on('*', (payload: SupabaseRealtimePayload<Profile>) => profileUpdated(profiles, payload.new))
2019
.subscribe()
2120

2221
return () => {
23-
if (realtimeProfiles) supabase.removeChannel(realtimeProfiles)
22+
if (realtimeProfiles) supabase.removeSubscription(realtimeProfiles)
2423
}
2524
}, [])
2625

0 commit comments

Comments
 (0)