Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.

Speed up loading the initial data, by using the 'value' callback.#213

Closed
dickp wants to merge 4 commits intoFirebaseExtended:masterfrom
dickp:query-speedup
Closed

Speed up loading the initial data, by using the 'value' callback.#213
dickp wants to merge 4 commits intoFirebaseExtended:masterfrom
dickp:query-speedup

Conversation

@dickp
Copy link
Copy Markdown
Contributor

@dickp dickp commented Apr 28, 2017

When 'value' has finished, then start listening for 'child_added'; in
the 'child_added' callback, ignore any additions that we already have.

All polymerfire tests pass.

Fixes #212

When 'value' has finished, then start listening for 'child_added'; in
the 'child_added' callback, ignore any additions that we already have.
@googlebot
Copy link
Copy Markdown

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.

@dickp
Copy link
Copy Markdown
Contributor Author

dickp commented Apr 28, 2017

I signed it!

Comment thread firebase-query.html Outdated
if (query) {
query.on('child_added', this.__onFirebaseChildAdded, this.__onError, this);
/* The 'value' event doesn't order the data, so we have to
* revert to the slow path if ordering is requested
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The DataSnapshot provided to the 'value' event is in fact ordered. But .val() returns it as a plain JS Object, which is not ordered. To preserve ordering, you can iterate the DataSnapshot using the .forEach() method.

Comment thread firebase-query.html Outdated
}

/* Now start listening for changes */
this.query.on('child_added', this.__onFirebaseChildAdded, this.__onError, this);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You can attach this right away but ignore the events you get before the first 'value' event.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mikelehen I forked @dickp 's branch and asked for a PR on his side that is connected to here, using what you have suggested

dickp#1

tjmonsi added 2 commits May 6, 2017 09:37
Signed-off-by: Toni-Jan Keith Monserrat <tonijanmonserrat@gmail.com>
Signed-off-by: Toni-Jan Keith Monserrat <tonijanmonserrat@gmail.com>
@dickp
Copy link
Copy Markdown
Contributor Author

dickp commented May 6, 2017

I signed it! Again!

@tjmonsi
Copy link
Copy Markdown
Contributor

tjmonsi commented May 6, 2017

@dickp I think it is @ecgtheow that is not signed in?

Copy link
Copy Markdown

@mikelehen mikelehen left a comment

Choose a reason for hiding this comment

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

This looks good to me.

Personally, I'd attach the child_added event right away (with the rest of the events) and add a gotInitialEvents flag, which is set to true on the first 'value' event... and onFirebaseChildAdded would just ignore any events until the flag was set to true. (and then you wouldn't need the __map[key] check in onFirebaseChildAdded anymore...) But there's probably no material difference.

@dickp
Copy link
Copy Markdown
Contributor Author

dickp commented May 8, 2017

@tjmonsi Someone in the CLA office didn't think I was authorised to sign on behalf of my company, so I tried again.

When I get around to it, I'll be converting @ecgtheow to an organisation account anyway.

@mikelehen
Copy link
Copy Markdown

Changes look good to me (thanks)!

@justweb1
Copy link
Copy Markdown

I think @ecgtheow is the one that needs to sign the CLA.

@dickp
Copy link
Copy Markdown
Contributor Author

dickp commented May 25, 2017

@justweb1 I have been trying to sign the CLA as @ecgtheow, but someone in the CLA office keeps deciding I don't have the authority and voiding the signature. I've pointed them at the UK government's companies registration site, but it's like talking to a brick wall.

I'll try signing it yet again now.

@dickp
Copy link
Copy Markdown
Contributor Author

dickp commented May 25, 2017

Aaaand they 'voided' it again. I give up.

@mbleigh
Copy link
Copy Markdown
Contributor

mbleigh commented May 25, 2017

@dickp would you be willing to re-open this in a new PR as a single commit from just your personal account? That should make the CLA bot happy (I hope).

@dickp
Copy link
Copy Markdown
Contributor Author

dickp commented May 25, 2017

I don't think it's the CLA bot. Every time I try to sign it, I get an email back that says:

"Google Contributor License Agreement for Ecgtheow Ltd has been voided for the following reason:

Please have this document signed by an authorized executive. ..."

No "please show us some documentation" (I tried to), not that that would help as emails to cla-submissions@google.com seem to go straight to /dev/null anyway.

It's a bank holiday weekend here and I'm making it a long one. I might have some time next week to look at this.

@justweb1
Copy link
Copy Markdown

@dickp if you squash all if the changes into one commit using your username instead if the company you will be able to submit a new OR with no issue.

@christophe-g
Copy link
Copy Markdown
Contributor

Hey,
That seems to be a great PR - which should solve some of the perf issue I have with firebase-query.
Any news re CLA or new PR?
thanks!

@mbleigh
Copy link
Copy Markdown
Contributor

mbleigh commented Jul 12, 2017

Supplanted by new PR with functioning CLA.

@mbleigh mbleigh closed this Jul 12, 2017
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.

7 participants