Comments (2)
What do you see when you take a look at the resulting json? The numbers don't really strike me as odd when you're serializing a complete tree of objects?
Looks from the trace that you serialize some 16 objects, each of which has five HasOne
relations, which in turn have some some HasOne
relations, which have a HasMany
relation yet again. So you end up with some 16 * 5 = 80 * 3 = 240 * 3 => roughly 720 (+ 240 + 80 + 16) calls, before all models have been serialized and the recursion dies out.
Do you really need all the related data in the render method? If not, it's probably better to pass model.attributes
in as the template parameters. If you need related data, you probably don't need all of it. Try adding the includeInJSON
parameter strategically to some relations that you don't need to have serialized fully (not here, and not in save
calls either, since these are global settings), with a value of false
or a string referencing the idAttribute
.
(Btw, I see that you still invoke some super methods on Backbone.Model, in https://github.com/Concert/Concert/blob/loggedinpage/concertapp/static/js/lib/models/ConcertModel.js . Those should be invoked on Backbone.RelationalModel, so destroyed models get cleaned up properly)
from backbone-relational.
Thanks so much.
I hope to fix this in the near future.
Also thanks for the note on my model super classes.
from backbone-relational.
Related Issues (20)
- Backbone send null for unset relations HOT 1
- Backbone Relational dealing with model instances with the same ID HOT 2
- Retain model in collection when unsetting on another relationship HOT 1
- Models without id (only cid) are not registered in Backbone.Relational.Store HOT 1
- Doesn't work with lodash 4.1.0 HOT 1
- Is this project abandoned? HOT 6
- Backbone 1.3.2 support HOT 2
- using toJSON to serialize data HOT 3
- Update documentation for ES2015/CommonJS importing
- JSBin example HOT 1
- Rename Backbone-relational to backbone.relational HOT 4
- Double imports for using with webpack HOT 5
- ES2015 Refactor (Release Checklist) HOT 1
- Store causing huge memory retention and cleanup takes forever HOT 2
- How do I get Backbone-relational working with ES6? HOT 6
- Problem defining relations: "model does not inherit from Backbone.RelationalModel" HOT 6
- getAsync() fails when retrieving to many models using set URL HOT 4
- don't initialize related Model/Collection in defaults HOT 2
- Collection instances share `options` object by reference which is unexpected
- Backbone-relational compactibility with typescript
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from backbone-relational.