Skip to content

Question to snapshot.getPromise vs snapshot.getLoadable #2012

Answered by drarmstr
miracle0930 asked this question in Q&A
Discussion options

You must be logged in to vote

As you point out they are very similar. getLoadable() is synchronous and returns a Loadable object which encodes the state and either the value, error, or promise to an async value. getPromise() on the other hand returns an async promise to the value, even if the value is synchronous or rejected to the error. You may wish to use the getLoadable() version if you want to synchronously handle the result, error, or pending state.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by miracle0930
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2009 on September 16, 2022 22:17.