File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
examples/SampleApp/src/hooks Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -181,7 +181,7 @@ export const useChatClient = () => {
181181 } ;
182182
183183 const logout = async ( ) => {
184- SqliteClient . resetDB ( ) ;
184+ await SqliteClient . resetDB ( ) ;
185185 setChatClient ( null ) ;
186186 chatClient ?. disconnectUser ( ) ;
187187 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 {
6666 throw new Error ( 'DB is not open or initialized.' ) ;
6767 }
6868 this . db . close ( ) ;
69+ this . db = undefined ;
6970 } catch ( e ) {
7071 this . logger ?.( 'error' , `Error closing database ${ SqliteClient . dbName } ` , {
7172 error : e ,
@@ -200,7 +201,10 @@ export class SqliteClient {
200201
201202 static resetDB = async ( ) => {
202203 this . logger ?.( 'info' , `resetDB` ) ;
203- SqliteClient . dropTables ( ) ;
204+ await SqliteClient . dropTables ( ) ;
205+ if ( this . db ) {
206+ SqliteClient . closeDB ( ) ;
207+ }
204208 await SqliteClient . initializeDatabase ( ) ;
205209 } ;
206210}
You can’t perform that action at this time.
0 commit comments