How to properly await data retrieval with useDatabaseList
in setup script?
#1328
Unanswered
Crease29
asked this question in
Questions and Help
Replies: 1 comment 1 reply
-
I've now tried the following approach, which seems to work reliably but I'm not sure, if that's the way how it's intended? <script setup>
import {useDatabase, useDatabaseList} from "vuefire";
import {ref as dbRef} from "firebase/database";
const {data: config, promise: configPromise} = useDatabaseList(dbRef(useDatabase(), 'config'));
await configPromise.value;
console.log(config.value); // Proxy {0: {…}}
</script> |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey there,
I'm having some troubles in understanding how to properly await data loading via
useDatabaseList
.Here's my example:
Interestingly, when I change something in my code and the automatic component reload happens in my dev environment, also the first
console.log
returns the data then.So I'd love to get some hints how to reliably await data retrieval from a DatabaseList.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions