vuejs / vuefire

🔥 Firebase bindings for Vue.js
https://vuefire.vuejs.org
MIT License
3.82k stars 323 forks source link

Readonly `id` field is undefined by default (despite filled other data) #1512

Closed szulcus closed 3 months ago

szulcus commented 3 months ago

Reproduction

I can't reproduce it from playground

Steps to reproduce the bug

goodAnswers is array of reference: image

onMounted(() => {
    console.log(props.progress.goodAnswers.map(({ id }) => id) }); // [undefined, undefined]
    setTimeout(() => {
        console.log(props.progress.goodAnswers.map(({ id }) => id) }); // ['xiWxG3fVcERWTVRYBYPQ', 'utsEgcpNrmRz95Xb9J6M']
    }, 1000);
});

Expected behavior

Field id available with other data or correct type (string | undefined)

Actual behavior

Like below, in title

Additional information

"nuxt": "^3.5.3" "vuefire": "^3.1.23"

Workaround

Check manually if all ids are defined, e.g.: !progress || progress.goodAnswers.some((ans) => !ans.id)" instead of !progress