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

fix(remote-config): error calling getValue() before fetch #4068

Merged
merged 5 commits into from
Aug 15, 2020

Conversation

imwexpex
Copy link
Contributor

Description

remoteConfig().getValue() errored when it invokes before fetch values success/failed, because this._values is undefined.
Added check for the correct type of "target" to hasOwnProperty method to prevent this issue.

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
  • My change includes tests;
    • [-] e2e tests added or updated in packages/\*\*/e2e
    • [-] jest tests added or updated in packages/\*\*/__tests__
  • [-] I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • [-] No

@CLAassistant
Copy link

CLAassistant commented Aug 11, 2020

CLA assistant check
All committers have signed the CLA.

mikehardy
mikehardy previously approved these changes Aug 11, 2020
Copy link
Collaborator

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

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

Interesting - this looks good to me but since this is a common function I'd like a second pair of 👀

@mikehardy mikehardy added Workflow: Needs Review Pending feedback or review from a maintainer. impact: crash Behaviour causing app to crash. plugin: app-core Firebase Apps / Core internals. labels Aug 11, 2020
@imwexpex
Copy link
Contributor Author

Interesting - this looks good to me but since this is a common function I'd like a second pair of 👀

As an option, we can check is this._values !== undefined inside getValue() method.

@mikehardy mikehardy requested a review from Salakar August 14, 2020 14:43
@Salakar
Copy link
Contributor

Salakar commented Aug 15, 2020

Interesting - this looks good to me but since this is a common function I'd like a second pair of 👀

As an option, we can check is this._values !== undefined inside getValue() method.

I'd prefer we did this rather than change a function in core 😅 would you mind making this change instead?

@imwexpex
Copy link
Contributor Author

Interesting - this looks good to me but since this is a common function I'd like a second pair of 👀

As an option, we can check is this._values !== undefined inside getValue() method.

I'd prefer we did this rather than change a function in core 😅 would you mind making this change instead?

Not a problem!

@Salakar Salakar changed the title fix(remote-config/app): error while calling remoteConfig().getValue() before fetch success fix(remote-config): error calling remoteConfig().getValue() before fetch Aug 15, 2020
@Salakar
Copy link
Contributor

Salakar commented Aug 15, 2020

Thank you :) LGTM, waiting for CI then I'll merge.

@Salakar
Copy link
Contributor

Salakar commented Aug 15, 2020

LGTM GIF

@Salakar Salakar changed the title fix(remote-config): error calling remoteConfig().getValue() before fetch fix(remote-config): error calling getValue() before fetch Aug 15, 2020
@Salakar Salakar merged commit 8619d72 into invertase:master Aug 15, 2020
@mikehardy mikehardy removed the Workflow: Needs Review Pending feedback or review from a maintainer. label Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact: crash Behaviour causing app to crash. plugin: app-core Firebase Apps / Core internals.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants