I have ember CLI addon which was going pretty well (demo) and then I thought I’d refactor/cleanup and bring in some much needed Unit Tests. Ok well that’s done but now I find myself with a problem that I just can’t put my finger on. Hoping someone can help:
- You can change the sort order or modify CSS binding with the
compressed button … works without issue
- The problem is, as soon as you trigger the
content computed property by changing
mood you get:
Uncaught TypeError: Cannot convert object to primitive value
I’ve included the stack trace here (which I find pretty much indecipherable):
The CP in question is here:
The updated demo with things in their current “broken state” is here: demo
Hey @knysde! Did you find a solution for this? I have the exact same error.
@ksnyde I believe that error is because somewhere in the code it is trying to treat an object as a string in some particular corner case. So I would suggest trying to carefully double check before you perform any string operations such as capitalize on anything. You might find a case where you are in fact not handed a string when you expected one.
To start I would suggest console logging the default case where you are switching on the
typeOf(filter) it may be some corner case there. After the default try placing something like this
And watch for anything unexpected.
Are you certain that
filteredContent is guaranteed to be an array in all cases? You might want to have a check for that before you attempt the foreach. Perhaps place a debugger in there to understand what is going on.
You can always try
Also, probably want to double check what is happening inside that
itemsArray.map with a console log on the item parameter.
Good luck debugging.