Skip to content

Add useFirestoreEmulator #4142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 5, 2021
Merged

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Dec 1, 2020

This add useFirestoreEmulator to firestore-exp.

Note: This is tested by the existing Firestore.useEmulator tests as the invoke useFirestoreEmulator indirectly.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Dec 1, 2020

Size Analysis Report

Affected Products

No changes between base commit (487f8e1) and head commit (769db12).

Test Logs

@@ -521,6 +521,9 @@ export function updateDoc(reference: DocumentReference<unknown>, data: UpdateDat
// @public
export function updateDoc(reference: DocumentReference<unknown>, field: string | FieldPath, value: unknown, ...moreFieldsAndValues: unknown[]): Promise<void>;

// @public
export function useFirestoreEmulator(firestore: FirebaseFirestore_2, host: string, port: number): void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the _2 intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's because we share the code from firestore-lite and firestore-exp. This should go away once #4140 is merged.

): void {
firestore = cast(firestore, FirebaseFirestore);

if (firestore._getSettings().host !== DEFAULT_HOST) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of scope here but I recently realized that this warning shows up if you repeatedly call useEmulator() with the same arguments. If you feel like fixing it, we could check settings.host !== DEFAULT_HOST && settings.host !== host or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me fix that.

@firebase firebase deleted a comment from changeset-bot bot Jan 5, 2021
@firebase firebase deleted a comment from changeset-bot bot Jan 5, 2021
@schmidt-sebastian
Copy link
Contributor Author

@hsubox76 Friendly ping.

@schmidt-sebastian schmidt-sebastian merged commit 4512bc9 into master Jan 5, 2021
@firebase firebase locked and limited conversation to collaborators Feb 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants