@@ -24,6 +24,7 @@ import {
24
24
} from '@firebase/app-exp' ;
25
25
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types' ;
26
26
import { Provider } from '@firebase/component' ;
27
+ import { deepEqual } from '../../../util/dist' ;
27
28
28
29
import {
29
30
IndexedDbOfflineComponentProvider ,
@@ -129,23 +130,8 @@ export function initializeFirestore(
129
130
130
131
if ( provider . isInitialized ( ) ) {
131
132
const existingInstance = provider . getImmediate ( ) ;
132
- const initialOptions = provider . getOptions ( ) as FirestoreSettings ;
133
- // Every option can currently be compared shallowly.
134
- // We could currently do a deepEqual() on `settings` but if we add
135
- // a new option to `FirestoreSettings` that needs a custom
136
- // comparison, it should be coded separately. This makes it less
137
- // likely to be missed.
138
- const shallowOptionsKeys : Array < keyof FirestoreSettings > = [
139
- 'cacheSizeBytes' ,
140
- 'experimentalAutoDetectLongPolling' ,
141
- 'experimentalForceLongPolling' ,
142
- 'host' ,
143
- 'ignoreUndefinedProperties' ,
144
- 'ssl'
145
- ] ;
146
- if (
147
- shallowOptionsKeys . every ( key => initialOptions [ key ] === settings [ key ] )
148
- ) {
133
+ const initialSettings = provider . getOptions ( ) as FirestoreSettings ;
134
+ if ( deepEqual ( initialSettings , settings ) ) {
149
135
return existingInstance ;
150
136
} else {
151
137
throw new FirestoreError (
0 commit comments