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

Fix _removeModels regression #3803

Merged
merged 1 commit into from
Sep 25, 2015

Conversation

jridgewell
Copy link
Collaborator

Fixes #3693.

This leaves open the question of whether events triggered on the model
during a ‘remove’ listener should also trigger on the collection. Just
something to revisit for V2.

col.on('other', (model) => {
  // Should this be triggered?
});

col.on('remove', (model) => {
  // If the model is really "removed" (we can't `#get` it anymore)
  // by the time this listener is called, then I'd argue that this
  // shouldn't trigger the 'other' event on the collection...
  model.trigger('other');
});

Fixes jashkenas#3693.

This leaves open the question of whether events triggered on the model
during a ‘remove’ listener should also trigger on the model. Just
something to revisit for V2.

```js
col.on('other', (model) => {
// Should this be triggered?
});

col.on('remove', (model) => {
// If the model is really "removed" (we can't `#get` it anymore)
// by the time this listener is called, then I'd argue that this
// shouldn't trigger the 'other' event on the collection...
model.trigger('other');
});
```
jashkenas added a commit that referenced this pull request Sep 25, 2015
@jashkenas jashkenas merged commit 979adf5 into jashkenas:master Sep 25, 2015
@akre54
Copy link
Collaborator

akre54 commented Sep 25, 2015

All events maybe not, but a remove definitely should.

@jridgewell
Copy link
Collaborator Author

I think this warrants a v1.2.4?

@akre54
Copy link
Collaborator

akre54 commented Sep 25, 2015

Want to add a test that col.on('other', ...) doesn't trigger?

@jridgewell
Copy link
Collaborator Author

It's in #3806, but I'm waiting till v2.

@jridgewell jridgewell mentioned this pull request Oct 27, 2015
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants