-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Regression from changing success callback parameters. #2161
Comments
Probably fixed by something like ...
fetch: function(options) {
options = options ? _.clone(options) : {};
if (options.parse === void 0) options.parse = true;
var success = options.success;
options.success = function(collection, resp, opts) {
options = _.extend( options, opts );
var method = options.update ? 'update' : 'reset';
collection[method](resp, options);
if (success) success(collection, resp, options);
};
... wherever options need to be extended through the success callback. |
I'm seeing the same thing with backbone 0.9.10 and underscore 1.4.3. Did not have this issue with 0.9.2 and 1.4.2. |
@timmywil: I tried what you suggested but no luck on my side. The call doesn't fail as undefined anymore, but the |
I was guessing it was an easy fix, but I didn't do a ton of investigation. I will look into it more and do a pull request.
On Jan 18, 2013, at 9:49 PM, Tony Lukasavage notifications@github.com wrote:
|
|
@wyuenho I get that that's supposed to happen, but what I'm seeing is not the case. The |
Custom |
@wyuenho : It is definitely shadowing, but it sounds like it may have been purposeful, which is what brought about all this confusion. @caseywebdev : seems superfluous and unnecessary. Is there ever a time where you'd want |
@timmywil and @tonylukasavage - #2221 should fix this one - internally the success callback parameters are reverted, so the options and model are referenced from the closure and the success/error from sync are only called with a single argument. If there are any issues with this, let us know and we can reopen. Thanks! |
In 6d589ba, success callback parameters were altered to include
options
as the third argument. Unfortunately, this shadows anyoptions
argument in the scope above. I ran into this when upgrading to 0.9.10 and noticed an exception thrown on a fetch call with no arguments. "Uncaught TypeError: Cannot read property 'update' of undefined " See line 814 for an example.The text was updated successfully, but these errors were encountered: