samuelgozi/firebase-firestore-lite

Check edge cases (empty values) when decoding values

Closed this issue · 3 comments

Hi @samuelgozi, thanks again for these amazing libs !

I found a bug while having an empty Array in a firestore document (but still available in the firebase console).

It is related to the decodeValue function in the utils.js, line 141
case 'arrayValue': return value.values.map(val => decodeValue(val, db));
To use .map, we need to be sure that value in not an empty array (by checking the length like value.length > 0 or if value.values exists)

We need to check all the edge cases, do you have some ideas ?
Thanks !

Thank you.
Can you please elaborate on the bug?
What is the current behavior?

Edit: Ohh, I get it. It throws when decoding an array without values prop. I'll fix it in a few minutes.

@mkhennoussi Thanks for opening the issue.
It is fixed, you should update to version 0.6.2 to see the changes.
Take care!

Thanks a lot @samuelgozi ! Take care too !