Exception from Tracker recompute function ( Invariant Violation )

Weird behavior that I can’t explain:
Here’s a react component that shows a stringified object - data from google account.
enter image description here
enter image description here

If I change props.user[0].services to
                  props.user[0].services.google property
enter image description here
I get an error:

enter image description here

I cannot see the actual data, but it might be that the services property is loaded after the function call.

On a different topic. To prevent these errors you might want to use lodash’s _.get function. It allows you to give defaults aswell:

const googleProps = _.get(props, 'user[0].services.google', {});
return JSON.stringify(googleProps, null, 4);

Yep, it helps. I’m curious if it’s good practise to get google’s account picture and email that way?

and copy your answer here please

Yup definitely. The way I would approach this is as follows.:

const googleProps = _.get(props, 'user[0].services.google', {
    picture: 'https://some-source/default-picture.png',
    email: 'unknown'
});