Giter VIP home page Giter VIP logo

Comments (10)

matthieugayon avatar matthieugayon commented on June 16, 2024

while debugging it appears that "Store.prototype.create" function line 165 doesn't receive backbone models but the whole xhr response object like : { request : Object , success : Object }

from backbone.dualstorage.

 avatar commented on June 16, 2024

the undefined 'set' error is probably because your server returns something other than 'id' as the 'id' attribute - eg 'ID' or '_id'. Either change the server response or parse the incoming data using parse or parseBeforeLocalSave methods on your collection/model. That error also indicates the requireJS is loading things in the right order.

from backbone.dualstorage.

matthieugayon avatar matthieugayon commented on June 16, 2024

i've juste taken a look and my server is returning the "id" attribute correctly ...

from backbone.dualstorage.

matthieugayon avatar matthieugayon commented on June 16, 2024

But i still don't get a clue why the whole xhr response is passed to the Store.prototype.create method instead of this method being served model by model...

from backbone.dualstorage.

nilbus avatar nilbus commented on June 16, 2024

There is a known issue where Store.create is sometimes passed a backbone model and sometimes passed its attributes. I'll be working on this next when I find some time. See the comments in #37.

from backbone.dualstorage.

matthieugayon avatar matthieugayon commented on June 16, 2024

Ok cool, I finally made it work on few collections. Actually , i didn't really understand since now the use of parseBeforeLocalSave, and it happened that the response was not parsed at all while entering the dualStorage process, thus, not passing response.response, but the whole response object. So my collections are well parsed now, but i'm still facing couple of issues, i'll let you know after some work ...

from backbone.dualstorage.

matthieugayon avatar matthieugayon commented on June 16, 2024

Oh yeah , i made it work finally , thanks for the answers !

By the way i have another question : how do you manage memory use when the application's cache is reaching the maximum size ( around 5Mo i think ) ? Are you deleting the oldest model ? is it possible to customise this function ? The backbone-fetch-cache is doing the job for that
https://github.com/mrappleton/backbone-fetch-cache#priorityfn

from backbone.dualstorage.

nilbus avatar nilbus commented on June 16, 2024

I'm glad you got it working.

That's actually a big problem that we are hoping someday to resolve using a storage backends like IndexedDB which can grow beyond the 5mb (FireFox) or 2.5mb (Chrome) that is allotted to localstorage. My plan is to use Lawnchair as a common interface to both localstorage and IndexedDB. Before that can happen, we're going to have to stop relying on Store being synchronous as it is now with localstorage. IndexedDB and Lawnchair give all responses as asynchronous callbacks. This could happen either by making everything use callbacks internally, or using something like promises.

Unfortunately, I'm not going to be able to implement that anytime soon. There are more pressing issues, and my time is limited. Let me know if this is something you'd be interested in working on though.

from backbone.dualstorage.

BananaNeil avatar BananaNeil commented on June 16, 2024

@matthieugayon Can you please provide some details about how you got it to work? I am having the same issue, it seems.

from backbone.dualstorage.

nilbus avatar nilbus commented on June 16, 2024

There were a couple problems mentioned here. What problem specifically are
you having?

On Friday, September 27, 2013, BananaNeil wrote:

@matthieugayon https://github.com/matthieugayon Can you please provide
some details about how you got it to work? I am having the same issue, it
seems.


Reply to this email directly or view it on GitHubhttps://github.com//issues/46#issuecomment-25283703
.

from backbone.dualstorage.

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.