0

I've run into a problem where calling destroy() on a model object triggers the "destroy" event but doesn't actually discard the model object.

I am using relations, but seem to be coming across the problem with or without relationships.

var stagelet = stage.stagelets().findByAttribute("reference", id);
stagelet.destroy();

Triggers the destroy event, but then calling:

stage.stagelets().all();

will still return the recently destroyed object. Are there situations in which these destroyed objects remain in the store or should I look elsewhere for my issue?

Dandy
  • 1,203
  • 1
  • 16
  • 31

1 Answers1

0

That looks like a bug, objects that are destroyed should not be returned by .all()

If you can submit a test case via a pull request on github we can look into it further.

aeischeid
  • 576
  • 3
  • 12
  • I'll have to do some work to hunt down what is causing this problem, as it is something that seems to pop up when I'm knee deep in an application and isn't obviously apparent at times. My temporary solution was to add a removed property and check objects against that, since it seems to be isolated to specific cases. – Dandy Apr 02 '13 at 15:52