Skip to content

Instantly share code, notes, and snippets.

@aaronj1335
Last active December 15, 2015 10:29
Show Gist options
  • Select an option

  • Save aaronj1335/5245990 to your computer and use it in GitHub Desktop.

Select an option

Save aaronj1335/5245990 to your computer and use it in GitHub Desktop.

we should probably get some unit tests around the following corner cases:

  1. collection load's

  2. a collection has been loaded and includes a particular model

  3. that model is updated server-side, not on the page

  4. the collection is re-loaded, and the change from the server side is applied to the local copy of the model

  5. i don't know if the model triggers a change event in this case

  6. pertinent code: when a query resolves and converts the plain objects into model instances

  7. model creation (i.e. actually saving a new model, not just instantiating it):

  8. when a model is .save()'ed and it results in a create request, it should trigger some event on the manager, probably in the associate method. let's call these events from the manager 'add' events for clarity.

  9. if a collection is just loading everything, i.o.w. has no query, limit, or offset, then it should probably listen for these events, Collection#add() the new model to its set, and trigger an 'update'

  10. if a collection does have some sort of query, it can't be sure whether or not it should include the new model, so should it call .refresh()? this may be too aggressive

@aaronj1335
Copy link
Copy Markdown
Author

i'll add that clarification to 2.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment