File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
packages/firestore/src/lite-api Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import {
24
24
} from '@firebase/app' ;
25
25
import {
26
26
createMockUserToken ,
27
+ deepEqual ,
27
28
EmulatorMockTokenOptions ,
28
29
getDefaultEmulatorHostnameAndPort
29
30
} from '@firebase/util' ;
@@ -324,12 +325,20 @@ export function connectFirestoreEmulator(
324
325
'will be used.'
325
326
) ;
326
327
}
327
-
328
- firestore . _setSettings ( {
328
+ const privateSettings = {
329
329
...settings ,
330
330
host : newHostSetting ,
331
331
ssl : false
332
- } ) ;
332
+ } ;
333
+
334
+ // Turn this invocation into a no-op if the new configuration matches the current configuration.
335
+ // This helps support SSR enviornments where `connectFirestoreEmulator` could be called multiple
336
+ // times.
337
+ if ( deepEqual ( privateSettings , settings ) ) {
338
+ return ;
339
+ }
340
+
341
+ firestore . _setSettings ( privateSettings ) ;
333
342
334
343
if ( options . mockUserToken ) {
335
344
let token : string ;
You can’t perform that action at this time.
0 commit comments