File tree Expand file tree Collapse file tree 1 file changed +3
-23
lines changed
examples/typescript-supabase-todo/src Expand file tree Collapse file tree 1
8000
file changed +3
-23
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ export default function Todos(user) {
14
14
return (
15
15
< div >
16
16
< DataSaver user = { user } />
17
- < SignOut />
18
17
< NewTodo />
19
18
< hr />
20
19
< TodoFilters />
@@ -81,41 +80,22 @@ const DataSaver = (user) => {
81
80
} ) ;
82
81
}
83
82
} ) ;
84
- //TK
85
- console . log ( client . transactSilently )
86
- client . addTransactListener ( transactListener )
87
83
const on = ( action : any ) => ( ds : any ) => client . transactSilently ( [ [ action , ...ds . val ( ) ] ] )
88
84
subscription1 = supabase
89
85
. from ( 'entities' )
90
86
. on ( 'UPDATE' , ( v ) => on ( 'add' ) )
91
87
. on ( 'INSERT' , ( v ) => on ( 'add' ) )
92
88
. on ( 'DELETE' , ( v ) => on ( 'retract' ) )
93
89
. subscribe ( ( change ) => console . log ( 'todos changed' , change ) )
94
- /*
90
+
95
91
return ( ) => {
96
92
client . removeTransactListener ( )
97
- ref.off('child_added', on('add'))
98
- ref.off('child_removed', on('retract'))
99
- ref.off('child_changed', on('add'))
100
- }*/
93
+ supabase . removeSubscription ( subscription1 )
94
+ }
101
95
} , [ userId ] )
102
96
return null
103
97
}
104
98
105
- const SignOut = ( ) => {
106
- const [ client ] = useClient ( )
107
- return (
108
- < button
109
- style = { { float : 'right' } }
110
- onClick = { ( ) => {
111
-
112
- client . dbFromString ( window . emptyDB )
113
- firebase . auth ( ) . signOut ( )
114
- } }
115
- > Sign Out</ button >
116
- )
117
- }
118
-
119
99
const NewTodo = ( ) => {
120
100
const [ transact ] = useTransact ( )
121
101
return (
You can’t perform that action at this time.
0 commit comments