scttnlsn / backbone.io

Backbone.js sync via Socket.IO

Home Page:http://scttnlsn.github.io/backbone.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Collection.fetch( options );

elquedro opened this issue · comments

When using Collection.fetch to fetch a whole collection then the error and success callbacks are removed from the options argument.

As noticed from the comment, these callbacks should not be send to the backend. But these callbacks are removed (browser.js line 14 & 15) before the if-statement (browser.js line 17) that checks for if we are working with a backend. Now normal loaded collections do not work, they only work when used with a backend.

old:

    // Don't pass the callbacks to the backend
    delete options.error;
    delete options.success;

    if (backend) {
        // Use Socket.IO backend

new:

    if (backend) {
       // Don't pass the callbacks to the backend
       delete options.error;
       delete options.success;

       // Use Socket.IO backend

My non-backend collection now works when I move the delete commands to the body of the if-statement.

Does this fix break anything that I am not aware of?

Thanks for pointing this out. Committed the fix.