Skip to content

fix(utils): Make object $key and $exists properties non-enumerable #787

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 2 commits into from
Jan 23, 2017

Conversation

byrondover
Copy link
Contributor

Checklist

  • Issue number for this PR: Remove $key and $value on calls to set #302
  • Docs included?: no
  • Test units included?: yes
  • e2e tests included?: no
  • In a clean directory, npm install, npm run build, and npm test run successfully? yes

Description

Exact same pull request as #535, addresses rebase merge conflicts. All credit for original fix goes to @meDavid.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

1 similar comment
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@byrondover
Copy link
Contributor Author

byrondover commented Jan 23, 2017 via email

@googlebot
Copy link

CLAs look good, thanks!

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

@meDavid
Copy link

meDavid commented Jan 23, 2017

@byrondover Thanks you for finishing this

Copy link
Collaborator

@davideast davideast left a comment

Choose a reason for hiding this comment

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

@byrondover Thank you so much for doing this! Just two minor comments and then I think we can get it in. 🔥

unwrapped.$exists = () => {
return snapshot.exists();
};
Object.defineProperty(unwrapped, '$key', {value: snapshot.ref.key, enumerable: false});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Format this line to the following:

Object.defineProperty(unwrapped, '$key', {
  value: snapshot.ref.key,
  enumerable: false
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! => ef09ba1

@@ -81,12 +81,12 @@ describe('FirebaseObjectFactory', () => {


it('should emit unwrapped data by default', (done: any) => {
ref.set({ data: 'bar' }, () => {
const fixtureData = { data: 'bar' };
ref.set(fixtureData, () => {
subscription = observable.subscribe(unwrapped => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The observable subscription shouldn't be needed here. Can you remove it and just use the inner code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@davideast I'm not sure I follow. How can we assert the object properties after ref.set(), other than by subscribing to the object observable?

If it'll take too long to explain, please feel free to just tell me what to do here specifically, and I'm sure I'll figure it out as I implement the changes. 😎

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, my brain was malfunctioning. I looked at this too early in the morning. I forgot that there's a FirebaseObjectObservable variable in the outer scope. All is good!

Copy link
Collaborator

@davideast davideast left a comment

Choose a reason for hiding this comment

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

Just two minor comments and then we can merge it in!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants