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

firebase-document defaults to {} before resolving #33

@43081j

Description

@43081j

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 maybe null for when it doesn't exist).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions