Giter VIP home page Giter VIP logo

Comments (2)

PaulUithol avatar PaulUithol commented on September 6, 2024

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.

colinsullivan avatar colinsullivan commented on September 6, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.