mantrajs / meteor-mantra-kickstarter

Kickstart your meteor mantra development
MIT License
184 stars 50 forks source link

Astronomy methods run with wrong "this" context #6

Open krawalli opened 8 years ago

krawalli commented 8 years ago

Maybe because of react jsx, the call of a Astro Class methods from jsx does not have the "record" context, so the (current) record data is not usable:

see: /users The collection should show a list of email addresses for the users collection. No email address is shown, because the {record.firstEmail()} (from jsx) will call

return _.get(this, 'emails[0].address', null);

but "this" is not the expected "this" context for the record, its the window context of the browser

natecox commented 8 years ago

Out of curiosity, do you know if an arrow function is being used there? That would explain context not being passed properly.

Could you provide a reference to the line of code that's failing?