Skip to content

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

Closed
@posva

Description

@posva

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
  })
});

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions