convert RealmList to Array
Object.values(realm.objects('MyObject')) should return an array of realmObjects
the returned array is empty, only when running on an iOS device but not on android or in simulator, or when using chrome debugging
console.warn(Object.values(realm.objects('MyObject')).length)
I think you should use Array.from(realm.objects('MyObject')) instead - Object.values() relies on the object having enumerable own properties.
That said, maybe we should check why Realm.Results has enumerable properties on Android, but not on iOS, given that they're both using JavaScriptCore.
Thanks @fealebenpae , using Array.from is a fine solution for me, just wanted to make sure the realm team was aware of this weird inconsistency.
Most helpful comment
I think you should use
Array.from(realm.objects('MyObject'))instead -Object.values()relies on the object having enumerable own properties.That said, maybe we should check why
Realm.Resultshas enumerable properties on Android, but not on iOS, given that they're both using JavaScriptCore.