I can log the returned object to console (from within parent) but when I try to dig deeper I’ll get this error: Challenge.jsx:64 Uncaught TypeError: Cannot read property 'instructions' of undefined
There isn’t anything weird about the object I’m returning either:
I suppose you are subscribing somewhere? If so initially ChallengesDB.findOne(challengeId) will return null as there aren’t any documents in the store yet (takes a little for the server to send the data to the client). Accessing undefined.instructions is going to give problems, so best to change it to:
Yep that’s expected, but now you can handle that correctly in the child and your code won’t throw an error when looking for the instructions key. It’ll show false and when the subscriptions returns documents it should update to what you need.
Oh right, made a mistake. you are indeed going to only see false once since that function has no reactivity. You’ll need to set state on your subscription callback. Where do you do your subscription exactly?