Description
When using firebase-document, somewhere it defaults to the empty object (this).
This means in the common use case we observe the following values (in order):
undefined
{}
{ "foo": "bar" }
Where the last object is the actual document from Firebase.
In the old firebase elements, we would observe:
undefined
{ "foo": "bar" }
This is a problem because we can no longer expect a well structured (essentially "typed") object.
If we write a component for fetching and displaying posts, for example, we are forced to add a condition to ensure the document is the right "shape". We cannot safely assume that any object we get in our property is the correct structure/shape.
Additionally, this means if for some reason you try to fetch an array, you observe the following:
Which of course is crazy. The only values we should see are the resolved ones from the database and undefined (or maybe null for when it doesn't exist).
Description
When using
firebase-document, somewhere it defaults to the empty object (this).This means in the common use case we observe the following values (in order):
undefined{}{ "foo": "bar" }Where the last object is the actual document from Firebase.
In the old firebase elements, we would observe:
undefined{ "foo": "bar" }This is a problem because we can no longer expect a well structured (essentially "typed") object.
If we write a component for fetching and displaying posts, for example, we are forced to add a condition to ensure the document is the right "shape". We cannot safely assume that any object we get in our property is the correct structure/shape.
Additionally, this means if for some reason you try to fetch an array, you observe the following:
undefined{}[]Which of course is crazy. The only values we should see are the resolved ones from the database and
undefined(or maybenullfor when it doesn't exist).