Commit cc953d4 1 parent 9cb81db commit cc953d4 Copy full SHA for cc953d4
File tree 3 files changed +25
-4
lines changed
packages/app/src/systems/Core
3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " fuels-wallet " : patch
3
+ ---
4
+
5
+ fix: clean opfs when logging out
Original file line number Diff line number Diff line change
1
+ import { IS_LOGGED_KEY } from '~/config' ;
2
+ import { clearParallelDb } from '~/systems/Core/utils/databaseNoDexie' ;
1
3
import { VaultService } from '~/systems/Vault' ;
2
4
import { db } from '../utils/database' ;
5
+ import { cleanOPFS } from '../utils/opfs' ;
3
6
import { Storage } from '../utils/storage' ;
4
7
import { chromeStorage } from './chromeStorage' ;
5
- import { clearParallelDb } from '~/systems/Core/utils/databaseNoDexie' ;
6
- import { IS_LOGGED_KEY } from '~/config' ;
7
8
8
9
// biome-ignore lint/complexity/noStaticOnlyClass: <explanation>
9
10
export class CoreService {
10
11
static async clear ( ) {
11
- await chromeStorage . clear ( ) ;
12
12
await VaultService . clear ( ) ;
13
13
await db . clear ( ) ;
14
- Storage . clear ( ) ;
15
14
await clearParallelDb ( ) ;
15
+ try {
16
+ // this ones can fail depending on environment
17
+ Storage . clear ( ) ;
18
+ await chromeStorage . clear ( ) ;
19
+ await cleanOPFS ( ) ;
20
+ } catch ( e ) {
21
+ console . error ( e ) ;
22
+ }
23
+
16
24
const reloadAfterCleanCompleted = ( ) => {
17
25
const isLogged = Storage . getItem ( IS_LOGGED_KEY ) ;
18
26
if ( ! isLogged ) {
@@ -21,6 +29,7 @@ export class CoreService {
21
29
}
22
30
setTimeout ( ( ) => reloadAfterCleanCompleted ( ) , 50 ) ;
23
31
} ;
32
+
24
33
reloadAfterCleanCompleted ( ) ;
25
34
}
26
35
}
Original file line number Diff line number Diff line change @@ -35,3 +35,10 @@ export async function readFromOPFS() {
35
35
return { } ;
36
36
}
37
37
}
38
+
39
+ // create a function to clean opfs
40
+ export async function cleanOPFS ( ) {
41
+ const root = await initOPFS ( ) ;
42
+ if ( ! root ) return ;
43
+ await root . removeEntry ( 'backup.json' ) ;
44
+ }
You can’t perform that action at this time.
0 commit comments