rendrjs / rendr

Render your Backbone.js apps on the client and the server, using Node.js.
MIT License
4.09k stars 312 forks source link

Fix model retrival from store #410

Closed saponifi3d closed 9 years ago

saponifi3d commented 9 years ago

Bug: fetch would create a new model on page change - this would override the cache, killing the model stored in the cache. This destroys the models - but leaves some listeners around, cause memory leaks (that's bad too).

The fix: Checks to see if it's already a model, if it is, just return that instead of creating a new model (where the initialize method calls .store to save the model in the modelStore).

sarchila commented 9 years ago

This looks great and I look forward to having this merged :+1:

mdimas commented 9 years ago

Looks good to me. My only comment is it might be worth renaming _retrieveModelData. It was confusingly named before, and even more so now.

coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.24%) when pulling 457dce847ce417898137119874a8d66f618d6be9 on saponifi3d:fix-model-retrival-from-store into 41528534b9c608b48c16d241fef0a6b52a6dcfb5 on rendrjs:master.