@@ -53,22 +53,19 @@ export async function setOfflineComponentProvider(
53
53
persistenceSettings : PersistenceSettings ,
54
54
offlineComponentProvider : OfflineComponentProvider
55
55
) : Promise < void > {
56
- debugAssert (
57
- ! onlineComponentProviders . has ( firestore ) ,
58
- 'The offline component provider must be registered before the online ' +
59
- 'component provider.'
60
- ) ;
61
- const configuration = await firestore . _getConfiguration ( ) ;
62
- configuration . persistenceSettings = persistenceSettings ;
63
-
64
56
const offlineDeferred = new Deferred < OfflineComponentProvider > ( ) ;
65
57
offlineComponentProviders . set ( firestore , offlineDeferred . promise ) ;
66
58
59
+ const configuration = await firestore . _getConfiguration ( ) ;
60
+ configuration . persistenceSettings = persistenceSettings ;
61
+
67
62
logDebug ( LOG_TAG , 'Initializing OfflineComponentProvider' ) ;
68
63
await offlineComponentProvider . initialize ( configuration ) ;
69
64
firestore . _setCredentialChangeListener ( user =>
70
65
// TODO(firestorexp): This should be a retryable IndexedDB operation
71
66
firestore . _queue . enqueueAndForget ( ( ) =>
67
+ // TODO(firestorexp): Make sure handleUserChange is a no-op if user
68
+ // didn't change
72
69
offlineComponentProvider . localStore . handleUserChange ( user )
73
70
)
74
71
) ;
@@ -87,9 +84,10 @@ export async function setOnlineComponentProvider(
87
84
const onlineDeferred = new Deferred < OnlineComponentProvider > ( ) ;
88
85
onlineComponentProviders . set ( firestore , onlineDeferred . promise ) ;
89
86
90
- logDebug ( LOG_TAG , 'Initializing OnlineComponentProvider' ) ;
91
87
const configuration = await firestore . _getConfiguration ( ) ;
92
88
const offlineComponentProvider = await getOfflineComponentProvider ( firestore ) ;
89
+
90
+ logDebug ( LOG_TAG , 'Initializing OnlineComponentProvider' ) ;
93
91
await onlineComponentProvider . initialize (
94
92
offlineComponentProvider ,
95
93
configuration
0 commit comments