Skip to content

Commit 1c270b1

Browse files
committed
Revert file fully
1 parent b80c569 commit 1c270b1

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

packages/database/src/api/Database.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import { Provider } from '@firebase/component';
2727
import {
2828
getModularInstance,
2929
createMockUserToken,
30-
// deepEqual,
3130
EmulatorMockTokenOptions,
3231
getDefaultEmulatorHostnameAndPort
3332
} from '@firebase/util';
@@ -85,11 +84,12 @@ let useRestClient = false;
8584
*/
8685
function repoManagerApplyEmulatorSettings(
8786
repo: Repo,
88-
hostAndPort: string,
87+
host: string,
88+
port: number,
8989
tokenProvider?: AuthTokenProvider
9090
): void {
9191
repo.repoInfo_ = new RepoInfo(
92-
hostAndPort,
92+
`${host}:${port}`,
9393
/* secure= */ false,
9494
repo.repoInfo_.namespace,
9595
repo.repoInfo_.webSocketOnly,
@@ -350,22 +350,13 @@ export function connectDatabaseEmulator(
350350
): void {
351351
db = getModularInstance(db);
352352
db._checkNotDeleted('useEmulator');
353-
const hostAndPort = `${host}:${port}`;
354-
const repo = db._repoInternal;
355353
if (db._instanceStarted) {
356-
// If the instance has already been started, then silenty fail if this function is called again
357-
// with the same parameters. If the parameters differ then assert.
358-
if (
359-
hostAndPort === db._repoInternal.repoInfo_.host //&&
360-
//deepEqual(options, repo.repoInfo_.emulatorOptions)
361-
) {
362-
return;
363-
}
364354
fatal(
365-
'connectDatabaseEmulator() cannot alter the emulator configuration after the database instance has started.'
355+
'Cannot call useEmulator() after instance has already been initialized.'
366356
);
367357
}
368358

359+
const repo = db._repoInternal;
369360
let tokenProvider: EmulatorTokenProvider | undefined = undefined;
370361
if (repo.repoInfo_.nodeAdmin) {
371362
if (options.mockUserToken) {
@@ -383,7 +374,7 @@ export function connectDatabaseEmulator(
383374
}
384375

385376
// Modify the repo to apply emulator settings
386-
repoManagerApplyEmulatorSettings(repo, hostAndPort, tokenProvider);
377+
repoManagerApplyEmulatorSettings(repo, host, port, tokenProvider);
387378
}
388379

389380
/**

0 commit comments

Comments
 (0)