Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pattern.indexOf is not a function #11803

Closed
jerel opened this issue Jul 18, 2015 · 2 comments
Closed

pattern.indexOf is not a function #11803

jerel opened this issue Jul 18, 2015 · 2 comments

Comments

@jerel
Copy link
Contributor

jerel commented Jul 18, 2015

I noticed an uncaught error when upgrading an app from 2.0.0-beta1 to canary: pattern.indexOf is not a function. I found that it came from https://github.com/emberjs/ember.js/blob/master/packages/ember-metal/lib/expand_properties.js#L37-L39 which has a docblock that specifies that pattern is a string but also checks if pattern is of type string after calling indexOf on it. All tests appear to test with a string.

So anyway, while I was debugging I edited the Ember source in my app and moved the pattern.indexOf(' ') call inside the conditional and then received Ember.observer called without a function. Seems reasonable, something must be calling observer wrong. However while I was looking for the cause (I only have about 3 observers in this app, all correct) I restarted ember serve and the error went away. I'm unable to replicate it now.

So, I'm happy to submit a patch to make the behavior more user friendly if that's what is needed. Alternatively maybe someone else will hit the same error and can add details to this issue.

@gpoitch
Copy link
Contributor

gpoitch commented Jul 18, 2015

That error can occur when an observer has its function before its dependent key arguments, which was deprecated. See: #11778

@krisselden
Copy link
Contributor

@gdub22 @teddyzeenny @rwjblue unfortunately ember inspector throws the same error because it is using this form of observer(fn, key). It was fixed with emberjs/ember-inspector@3cb4460 but the released version I have throws this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants