reportFilters options die when in an Ember environment

Answered

When using the elasticsearch dataSourceType, providing any reportFilters to the slice will result in it dying with “I2y.toLocaleLowerCase is not a function”. I have not tested so I’m not sure this is unique to that dataSourceType.
This is because there’s a for…in loop without a doing a hasOwnProperty check. Ember adds a _super to the Array prototype which is what’s causing the bug. Removing this from the passed in options doesn’t work because it looks like at some point inside Flexmonster the array is cloned.
I’m not sure if this is helpful, but this is the bad code in my minified/obfuscated copy of Flexmonster:

for (var T3y in this.Fn) (P3y = this.cb(this.Fn[T3y])),

4 answers

Public
Ian Sadovy Flexmonster February 14, 2019

Hello Luke,
 
Thank you for such a detailed report.
We have reproduced the issue and made a hotfix.
So, you can download the update for Elasticsearch version from here: https://s3.amazonaws.com/flexmonster/2019/03m/20/FLEXMONSTER-PIVOT-BETA-ELASTICSEARCH.zip
 
Please let me know if it works for you.
 
Regards,
Ian

Public
Luke Deniston February 14, 2019

It still dies for me inside this function:

                    C79.prototype.Qu = function() {
this.MS(this.predefinedGroups);
var c19;
if (j4AA.t7k < this.Fn.length) {
for (var z19 in this.Fn)
c19 = this.cb(this.Fn[z19]),
j4AA.j1k != c19 && (this.GC ? this.filterMembersNegated.va(c19.ordinal, c19) : this.filterMembers.va(c19.ordinal, c19));
this.Fn = [];
}
}

Here’s the error:

VM69:formatted:21757 Uncaught TypeError: K09.toLocaleLowerCase is not a function
at D1O.C79.cb (<anonymous>:9:542930)
at D1O.C79.Qu (<anonymous>:9:554388)
at u1.yX (<anonymous>:9:1351720)
at o4G.f79.ts.length.o4G.r69.zk.ts (<anonymous>:9:1352144)
at <anonymous>:9:828137
at <anonymous>:9:829039
at i (elasticsearch.min.js?2.7.0-beta:formatted:10227)
at h (elasticsearch.min.js?2.7.0-beta:formatted:10208)
at FakeRequest.d.onreadystatechange (elasticsearch.min.js?2.7.0-beta:formatted:13462)

Inserting this code beforehand makes everything work:

delete Array.prototype._super;

But I don’t want to do that since it will break some of our other libraries.

Public
Ian Sadovy Flexmonster February 15, 2019

Hello Luke,
 
Thanks again for the details.
I have made another hotfix: https://s3.amazonaws.com/flexmonster/2019/03m/20/FLEXMONSTER-PIVOT-BETA-ELASTICSEARCH.zip
Please let me know if it works well now.
 
Regards,
Ian

Public
Luke Deniston February 15, 2019

That seems to have fixed the problem! Thanks for the rapid response.

Please login or Register to Submit Answer