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

Backbone 1.x support #72

Closed
hxgdzyuyi opened this issue Dec 18, 2012 · 25 comments
Closed

Backbone 1.x support #72

hxgdzyuyi opened this issue Dec 18, 2012 · 25 comments
Labels

Comments

@hxgdzyuyi
Copy link

No description provided.

@afeld
Copy link
Owner

afeld commented Dec 18, 2012

Just started a branch for it, but the tests are failing, so honestly, I can't promise when I can support it.

I started a rewrite using true nested Models instead of anonymous objects, but haven't been back to it in a while. The advantage there is that less behavior would be overridden/custom, which would theoretically provide better compatibility between versions.

@hxgdzyuyi
Copy link
Author

Stick in!

@ColColonCleaner
Copy link

Will work on this be continued?

@gkatsev
Copy link
Collaborator

gkatsev commented Sep 26, 2013

Any updates on this? also, I guess it should be backbone 1.0, rather than 0.9.9 nowdays 😸
Also, if you are changing it to use true nested models, how would it work if I have a model that I get back from my server that is already nested? Seems like the way it currently is set up, it'll just work and pick up the nesting.

@afeld
Copy link
Owner

afeld commented Sep 26, 2013

@gkatsev True - updated the title to make this more clear. The "nested model" thing is more an implementation detail... there would be no difference to the plugin user.

My big hesitation is that this plugin never really addressed associations, which may be a Good Thing™ to keep the scope contained, but is a bad because there's no clear path to making this handle associations well (even if it's a separate plugin). Feels like it's only providing a half-solution.

@gkatsev
Copy link
Collaborator

gkatsev commented Sep 26, 2013

yeah, what drew me to this specific plugin (over backbone-associations and backbone-relational) is that it was very simple.
So, it might be worth it to just keep this plugin simple by just providing change events for nested attributes and not add actual relations and instead point those people at one of the above plugins?

@afeld
Copy link
Owner

afeld commented Sep 26, 2013

@gkatsev Totally fair. Not sure when I'd be able to get back to this, but PRs are welcome, using my other branches or not!

@gkatsev
Copy link
Collaborator

gkatsev commented Sep 26, 2013

Yeah, not sure whether I have the capacity to do this at the moment either. But hopefully I could take a look soon.

@afeld
Copy link
Owner

afeld commented Sep 27, 2013

Added disclaimer to README re: associations. See #91.

@tuupola
Copy link

tuupola commented Oct 7, 2013

Is backbone-nested usable with Backbone 1.0.0? Cannot find this info from docs or readme.

@afeld
Copy link
Owner

afeld commented Oct 7, 2013

@tuupola No, that's what this issue is for.

@hxgdzyuyi
Copy link
Author

backbone has upgraded to 1.1.0 😢

@afeld
Copy link
Owner

afeld commented Oct 15, 2013

Updated the title to reflect this, at least 😕

@gkatsev
Copy link
Collaborator

gkatsev commented Oct 15, 2013

I'll have some time to hack on this next week. I hope that models between backbone 1.0 and 1.1 are compatible. I've heard there are some problems between 1.0 and 1.1.

@mreinstein
Copy link

If it's any consolation I took a look at the changelog for 1.1 and it doesn't look like there are many changes related to the model at all. The barrier to go from 1.0 to 1.1 should be pretty low for backbone-nested.

@gkatsev
Copy link
Collaborator

gkatsev commented Oct 21, 2013

Going to be working on this this week. Hopefully, it won't be too hard 👅

@afeld
Copy link
Owner

afeld commented Oct 21, 2013

🤘

@gkatsev
Copy link
Collaborator

gkatsev commented Oct 21, 2013

I've identified some reasons why the tests fail:

  • models only validate when validate: true or wait: true is passed into the model, it seems.
  • Backbone.wrapError is now a private function.
  • models now fire invalid rather than error events.
  • Model#change was removed.

Also, I saw this thing in the changelog for v1.1.0 as well:

Many tweaks, optimizations and bugfixes relating to Backbone 1.0, including URL overrides, mutation of options, bulk ordering, trailing slashes, edge-case listener leaks, nested model parsing..

@hxgdzyuyi
Copy link
Author

👍

@gkatsev
Copy link
Collaborator

gkatsev commented Oct 22, 2013

Most of the main tests failed because the expectations of how models worked changed slightly.
I now have backbone and nested models running against the model.js tests and passing. Working on getting the nested-model.js tests to pass now.

@gkatsev
Copy link
Collaborator

gkatsev commented Oct 22, 2013

Got the nested-model tests to all pass except one. This is because the remove event doesn't get triggered because there's a null check that never is true.
@afeld any thoughts on how this should work? Specifically, this remove also calls _setAttr to make sure that it only gets triggered when unset is called, since remove triggers the event explicitly.
One possibility I was thinking is moving the check into the unset block and then check whether val is an array and this works.

@gkatsev gkatsev mentioned this issue Oct 22, 2013
@tuupola
Copy link

tuupola commented Oct 24, 2013

👍

@gkatsev
Copy link
Collaborator

gkatsev commented Oct 24, 2013

If you guys could test backbone-nested from that branch, that would be awesome.

@afeld
Copy link
Owner

afeld commented Jan 8, 2014

Fixed by #96.

@afeld afeld closed this as completed Jan 8, 2014
@hxgdzyuyi
Copy link
Author

🚀

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

6 participants