mxriverlynn / backbone.picky

selectable entities as mixins for Backbone.Model and Backbone.Collection
129 stars 29 forks source link

Change events order #18

Closed STAH closed 10 years ago

hashchange commented 10 years ago

I don't know what made you propose this, but I have wondered about it too while tracing a bug. In my opinion,

I have fixed it in my PR for model sharing among collections (issue #23). Tests are included.

compojoom commented 10 years ago

Hey guys, Thank you for those PRs! I hope that Derick will look into them & finally give some love again to this repository. I spent the afternoon trying to track a bug in my code.

In my view I'm listening to the model's selected and deselected properties and I'm changing the css of the selected elements. Long story short - I was using smooth scrolling to scroll to the currently selected element. All the time I couldn't understand why the scrolling was working as expected sometimes, where other times it was with around 40px off... And this is when I realized that Backbone.Picky was for some reason triggering select first, then it was deselecting the element. My scroll was working as expected, but since the deselected was removing a css class of the element - it was positioned wrong.

@hashchange - I tested your PR and with it Backbone.Picky started to emit the events in the order one would expect. Thanks!

hashchange commented 10 years ago

@compojoom Thanks for the feedback!

As things stand now, Backbone.Picky is no longer maintained - the latest activity was almost a year ago, and I haven't been able to get the attention of Derick on Twitter either.

I have written a successor to Backbone.Picky earlier this year. It actually started off as a collection of Picky PRs which were gathering dust, and it is maintained, so I'd encourage anyone to consider switching. I wouldn't normally tout my own stuff on somebody elses bug tracker, but running into bugs which have long since been fixed is just a waste of time for anyone.

So have a look at Backbone.Select if you wish. It's fully compatible with Picky except for the initialization code - see the section on compatibility in the docs.

STAH commented 10 years ago

3 months with Backbone.Select in production app (some small changes to migrate from Picky). Great work!

hashchange commented 10 years ago

@STAH :)