File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
example/next-storage/components Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,7 @@ export default function ProfileList() {
14
14
15
15
realtimeProfiles = supabase
16
16
. from ( 'profiles' )
17
- . on ( '*' , ( payload : SupabaseRealtimePayload < Profile > ) => {
18
- console . log ( 'profiles' , profiles )
19
- const otherProfiles = profiles ?. filter ( ( x ) => x . id != payload . new . id )
20
- console . log ( 'otherProfiles' , otherProfiles )
21
- setProfiles ( [ payload . new , ...otherProfiles ] )
22
- } )
17
+ . on ( '*' , ( payload : SupabaseRealtimePayload < Profile > ) => profileUpdated ( payload . new ) )
23
18
. subscribe ( )
24
19
25
20
return ( ) => {
@@ -28,6 +23,11 @@ export default function ProfileList() {
28
23
}
29
24
} , [ ] )
30
25
26
+ function profileUpdated ( profile : Profile ) {
27
+ const otherProfiles = profiles ?. filter ( ( x ) => x . id != profile . id )
28
+ setProfiles ( [ profile , ...otherProfiles ] )
29
+ }
30
+
31
31
async function getPublicProfiles ( ) {
32
32
try {
33
33
const { data, error } = await supabase
You can’t perform that action at this time.
0 commit comments