Skip to content
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

Make initializeApp idempotent #5207

Merged
merged 7 commits into from
Jul 28, 2021
Merged

Make initializeApp idempotent #5207

merged 7 commits into from
Jul 28, 2021

Conversation

Feiyang1
Copy link
Member

initializeApp now can be called more than once and returns the same instance as long as using the same options and config. It should make the devX more friendly with HMR and other use cases.

No need to wrap initializeApp() in the if block anymore:

// the if condition can be safely removed now
// if(getApps().length === 0) {
    initializeApp({...})
// }

@changeset-bot
Copy link

changeset-bot bot commented Jul 28, 2021

🦋 Changeset detected

Latest commit: 86e4f91

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
@firebase/util Minor
@firebase/analytics Patch
@firebase/app-check Patch
@firebase/app Patch
@firebase/component Patch
@firebase/database Patch
firebase Patch
@firebase/firestore Patch
@firebase/installations Patch
@firebase/messaging Patch
@firebase/performance Patch
@firebase/remote-config Patch
@firebase/rules-unit-testing Patch
@firebase/storage Patch
@firebase/functions Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Feiyang1 Feiyang1 requested a review from egilmorez as a code owner July 28, 2021 00:35
@github-actions
Copy link
Contributor

github-actions bot commented Jul 28, 2021

Changeset File Check ⚠️

  • Warning: This PR modifies files in the following packages but they have not been included in the changeset file:

    • @firebase/app-compat
    • @firebase/app-exp

    Make sure this was intentional.

  • Package @firebase/util has a minor bump which requires an additional line to bump the main "firebase" package to minor.

packages-exp/app-compat/test/firebaseAppCompat.test.ts Outdated Show resolved Hide resolved
packages-exp/app-exp/src/errors.ts Outdated Show resolved Hide resolved
@Feiyang1 Feiyang1 merged commit a3cbe71 into master Jul 28, 2021
@Feiyang1 Feiyang1 deleted the fei-idempotentapp branch July 28, 2021 20:56
@google-oss-bot google-oss-bot mentioned this pull request Jul 28, 2021
@firebase firebase locked and limited conversation to collaborators Aug 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants