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

BackboneJS >0.9.9 doesn't accept model.set(other_model) anymore #425

Closed
vitorbaptista opened this issue May 13, 2014 · 2 comments
Closed
Assignees
Labels
Milestone

Comments

@vitorbaptista
Copy link
Contributor

As per the changelog at http://backbonejs.org/:

0.9.9

...
Model#set no longer accepts another model as an argument. This leads to subtle problems and is easily replaced with model.set(other.attributes).

We updated to 1.0.0 at 0801882 but forgot to do these changes, so there're a few places where Recline is failing silently. Using grep -rn "\.set(" src/ and filtering out valid uses, I got:

src/model.js:93:      self.set(results.metadata);
src/model.js:194:      this.queryState.set(queryObj, {silent: true});
src/view.multiview.js:230:    this.model.queryState.set(self.state.get('query'), {silent: true});
src/view.multiview.js:392:        self.state.set(update);
src/view.multiview.js:397:          self.state.set(update, {silent: true});
src/view.grid.js:244:    this.model.set(newData);
src/view.map.js:101:      self.state.set(self.menu.state.toJSON());
src/view.map.js:423:      this.menu.state.set(this.state.toJSON());
src/view.flot.js:62:      self.state.set(self.editor.state.toJSON());
src/view.flot.js:481:    this.state.set(updatedState);
src/view.slickgrid.js:304:      this.grid.setSortColumn(column, sortAsc);
src/view.slickgrid.js:312:    self.grid.setSelectionModel(new Slick.RowSelectionModel());
src/view.slickgrid.js:404:      model.set(v);

Not all of these lines are errors, but we'll need to double check.

@rufuspollock
Copy link
Member

Great spot and annoying tests did not catch this change. Do you want to try patching or would you like someone else to take a quick look? (Happy either way)

@vitorbaptista
Copy link
Contributor Author

I'll need this fixed for ckan/ckan#1251. If someone else is able to do it before me, great! If not, I'll do it 👍

@vitorbaptista vitorbaptista self-assigned this May 14, 2014
vitorbaptista added a commit to vitorbaptista/recline that referenced this issue May 14, 2014
The problem is that Backbone >= 0.9.9 doesn't accept anymore updating models
with:

    model.set(otherModel);

That needs to be changed to:

    model.set(otherModel.attributes);

Dataset.query() accepts both regular JS objects and Query models, so we need to
check the parameter type to support both.
vitorbaptista added a commit to vitorbaptista/recline that referenced this issue May 14, 2014
The problem is that Backbone >= 0.9.9 doesn't accept updating models with:

    model.set(otherModel);

That needs to be changed to:

    model.set(otherModel.attributes);

Dataset.query() accepts both regular JS objects and Query models, so we need to
check the parameter type to support both.
rufuspollock added a commit that referenced this issue May 15, 2014
…one-0.9.9

[#425] Fix Dataset.query() when called with Query model
vitorbaptista added a commit to ckan/ckan that referenced this issue May 15, 2014
@rufuspollock rufuspollock added this to the v0.7 milestone Aug 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants