Code Monkey home page Code Monkey logo

Comments (3)

acdlite avatar acdlite commented on May 17, 2024

Hi! Thanks for the feedback.

I agree that this seems redundant if your stores only contain JSON stringifiable (is that a word?) data, but it's often the case that Store data is not JSON stringifiable — for instance, using Immutable.js data types. In that case, JSON.stringify() and JSON.parse() will not work, hence the current solution, which is just to let the user define how to serialize and deserialize state.

The calls to JSON.stringify() and JSON.parse() you've identified in the code are only for the top-level tree of store keys to store data strings. So the parsed object looks like this:

{
  storeA: '{"foo": "bar"}', // String of JSON stringified data, but it could actually be anything returned by `Store#serialize()`
  storeB: '{"foo": "bar"}'
}

Then we iterate over the values and send the strings to the stores for deserialization. In other words, Flux#deserialize makes no assumptions about the type of data in your stores.

Does that make sense? I'm open to suggestions for how to make this better.

from flummox.

acdlite avatar acdlite commented on May 17, 2024

Ah! I read your comment again, and looked at the code again, and now I see the real issue — I'm passing the entire state string to Store#deserialize, not the store string! Oops! I'll fix this right away.

My previous comment is how it should work, though, so if you have any suggestions for how it could be better I'd still like to hear them :)

from flummox.

acdlite avatar acdlite commented on May 17, 2024

Fixed in 2.5.1

from flummox.

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.