Multiplicom / axiom

3 stars 0 forks source link

fix: don't lose context in callback #66

Closed michielvermeir closed 5 years ago

michielvermeir commented 5 years ago

Context This issue has been around for a long time https://sentry.prd-15.aws.agilent.com/multiplicom/mastr-reporter-dev/issues/6527/ (Aug 2019) https://sentry.prd-15.aws.agilent.com/multiplicom/mastr-reporter-production/issues/5015/ (Nov 2018) https://sentry.prd-15.aws.agilent.com/multiplicom/mastr-reporter-dev/issues/725/ (Dec 2017) https://sentry.prd-15.aws.agilent.com/multiplicom/mastr-reporter-dev/issues/108/ (Apr 2017)

Comments If renderTableContent is called from a call back, the context is lost and panel variable isn't bound. The typical solution is to use Function.prototype.bind on the callback, but this can only re-bind this.

I agree the solution is a bit funky, but has to do with the fact that these "classes" have been written using the "module" pattern to explicitly eschewthis. If you figure out a better way, let me know.