Skip to content

onSnapshot is missing on DocumentReferences created through DocumentSnapshot.data() #4134

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

Closed
posva opened this issue Nov 30, 2020 · 2 comments
Assignees

Comments

@posva
Copy link
Contributor

posva commented Nov 30, 2020

Describe your environment

  • Operating System version: osx
  • Browser version: edge 87
  • Firebase SDK version: 8.1.1
  • Firebase Product: firestore

Describe the problem

References read through a DocumentSnapshot.data() are not DocumentReference and are missing the onSnapshot function. This was present on v7 and it's useful for Vuefire to automatically listen to changes in nested references

Steps to reproduce:

  • Create a document with a reference to another document
  • Listen to changes through onSnapshot

Relevant Code:

(The stackblitz demo doesn't seem to work after upgrading firebase to 8.1.1). hopefull this code should give more context about seems like a regression

var db = firebase
  .initializeApp({
    projectId: "vue-fire-store",
    databaseURL: "https://vue-fire-store.firebaseio.com"
  })
  .firestore();

db.collection("tweets").onSnapshot(snaphot => {
  const changes = snapshot.docChanges();
  changes.added.forEach(({ doc }) => {
     doc.data().tweet.onSnaphot // undefined
  })
});
@dconeybe
Copy link
Contributor

This looks like a duplicate of #4125. If so, you could using version 8.0.2 until a fix is ready. Let me know if this works for you.

@dconeybe dconeybe self-assigned this Nov 30, 2020
@posva
Copy link
Contributor Author

posva commented Nov 30, 2020

Oh sorry, I didn't find the duplicate! It is indeed the same

@posva posva closed this as completed Nov 30, 2020
@firebase firebase locked and limited conversation to collaborators Dec 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants