Skip to content

Questions about using @next useDocument useCollection #1244

Closed Answered by posva
naranjamecanica asked this question in Questions and Help
Discussion options

You must be logged in to vote

Thanks for the feedback!

  1. Yes, you can call unbind() (const { data, unbind } = useDocument()) which is probably going to be renamed to stop() or something else
  2. It should be handled automatically by passing a ref (or shallow ref or computed) to useDocument() (same with collection):
const currentDocSource = computed(() => doc(db, route.params.id))
const currentDoc = useDocument(currentDocSource)

This makes me think I should support passing null | undefined to allow declarative unbinding: when currentDocSource.value is undefined or null, it will just unbind without binding a new doc

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
5 replies
@naranjamecanica
Comment options

@posva
Comment options

@posva
Comment options

@naranjamecanica
Comment options

@posva
Comment options

Answer selected by naranjamecanica
Comment options

You must be logged in to vote
1 reply
@ridernet
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants