File tree 2 files changed +6
-2
lines changed
examples/SampleApp/src/hooks
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -181,7 +181,7 @@ export const useChatClient = () => {
181
181
} ;
182
182
183
183
const logout = async ( ) => {
184
- SqliteClient . resetDB ( ) ;
184
+ await SqliteClient . resetDB ( ) ;
185
185
setChatClient ( null ) ;
186
186
chatClient ?. disconnectUser ( ) ;
187
187
await AsyncStore . removeItem ( '@stream-rn-sampleapp-login-config' ) ;
Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ export class SqliteClient {
66
66
throw new Error ( 'DB is not open or initialized.' ) ;
67
67
}
68
68
this . db . close ( ) ;
69
+ this . db = undefined ;
69
70
} catch ( e ) {
70
71
this . logger ?.( 'error' , `Error closing database ${ SqliteClient . dbName } ` , {
71
72
error : e ,
@@ -200,7 +201,10 @@ export class SqliteClient {
200
201
201
202
static resetDB = async ( ) => {
202
203
this . logger ?.( 'info' , `resetDB` ) ;
203
- SqliteClient . dropTables ( ) ;
204
+ if ( this . db ) {
205
+ await SqliteClient . dropTables ( ) ;
206
+ SqliteClient . closeDB ( ) ;
207
+ }
204
208
await SqliteClient . initializeDatabase ( ) ;
205
209
} ;
206
210
}
You can’t perform that action at this time.
0 commit comments