File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
packages/data-connect/src/cache Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -72,10 +72,13 @@ export class DataConnectCache {
7272 private connectorConfig : ConnectorConfig ,
7373 private host : string ,
7474 private cacheSettings ?: CacheSettings
75- ) { }
75+ ) {
76+ }
7677
7778 async initialize ( ) : Promise < void > {
7879 if ( ! this . cacheProvider ) {
80+ const identifier = await this . getIdentifier ( this . uid ) ;
81+ this . cacheProvider = this . initializeNewProviders ( identifier ) ;
7982 }
8083 }
8184
@@ -93,15 +96,15 @@ export class DataConnectCache {
9396
9497 setAuthProvider ( _authTokenProvider : AuthTokenProvider ) : void {
9598 this . authProvider . addTokenChangeListener ( async _ => {
99+ await this . cacheProvider ?. close ( ) ;
96100 this . uid = this . authProvider . getAuth ( ) . getUid ( ) ;
97- this . cacheProvider = await this . initializeNewProviders ( ) ;
101+ const identifier = await this . getIdentifier ( this . uid ) ;
102+ this . cacheProvider = this . initializeNewProviders ( identifier ) ;
98103 } ) ;
99104 }
100105
101- async initializeNewProviders ( ) : Promise < CacheProvider > {
102- await this . cacheProvider ?. close ( ) ;
106+ initializeNewProviders ( identifier : string ) : CacheProvider {
103107 let cacheProvider : CacheProvider ;
104- const identifier = await this . getIdentifier ( this . uid ) ;
105108 const isPersistenceEnabled =
106109 this . cacheSettings ?. storage instanceof PublicIndexedDbProvider ;
107110 if ( this . cacheSettings ) {
You can’t perform that action at this time.
0 commit comments