question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`$ref` no longer available, can't do `onDisconnect` calls anymore.

See original GitHub issue

Version info

Angular: 4.4.6

Firebase: 4.6.0

AngularFire: 5.0.0-rc.3

Other (e.g. Ionic/Cordova, Node, browser, operating system):

How to reproduce these conditions

Prior to upgrading to v5, the following code worked.

let donuts = this.db.object(`DONUTS`);
donuts.$ref.onDisconnect().set(false);

Now it no longer works as I can’t access the $ref property from the result of the call to this.db.object(). Any ideas on how I might regain onDisconnect functionality? I didn’t see this change in the migration docs, so this caught me off guard.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

11reactions
davideastcommented, Oct 20, 2017

Hey @aaronfrost! The query/ref is available on the AngularFireObject service, it’s just called query now.

let donuts = this.db.object(`DONUTS`);
// make sure to call .ref because you could be dealing with a query. Both Query and Reference have a .ref property to deal with this case.
donuts.query.ref.onDisconnect().set(false);

Thanks for flagging this, we’ll update our migration guide to indicate this.

1reaction
aaronfrostcommented, Oct 20, 2017

I agree with @jaufgang. The ref should be exposed differently, and that the proposed “solution” is more of a workaround, than a solution. Having to snapshotChanges and then subscribe, so that I can simply get a pointer to the ref is a lot of hoops that were’t necessary before. Since the API is being rev’d, this should be considered.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Complying with the Telemarketing Sales Rule
If a seller or telemarketer “upsells” a consumer during an unsolicited call initiated by the consumer, the upsell is covered by the TSR....
Read more >
Release notes for Amazon Connect
To help you keep track of the ongoing updates and improvements to Amazon Connect, we publish release notices that describe recent changes.
Read more >
Understanding and Handling Connection Lifetime Events ...
This article provides an overview of the SignalR connection, reconnection, and disconnection events that you can handle, and timeout and ...
Read more >
If you're changing phones, here's how to disconnect your ...
The best thing to do is to do a factory reset on your old phone when you change. But if you don't, certain...
Read more >
Reassigned Numbers Database
Callers can use the database to determine whether a telephone number may have been reassigned so they can avoid calling consumers who do...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found