Giter VIP home page Giter VIP logo

backbone-redux's People

Contributors

michelle-becker avatar morantron avatar somebody32 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

backbone-redux's Issues

Issue initializing -> (0 , _reduxDevtools.devTools) is not a function

Hi,

I've tried running as per Auto example, but I'm getting a console error on init:
Uncaught TypeError: (0 , _reduxDevtools.devTools) is not a function

for:
const finalCreateStore = compose(devTools())(createStore);

Ive used the example auto setup. I figure its to do with the Redux/React versions.
I've tried to match the versions to what you have:
"redux": "^3.0.0",
"redux-devtools": "^3.4.0"

Cheers
Gary

Define relations as functions

It'd be great if we could define the relations map as a function too.

For example, we might want to process data in our model to generate the actual key. For example, we might want to time related data by days, and to do so we'd parse an ISO timestamp to YYYY-MM-DD string.

Try to save the order of entities when merging new models

Now on every update changed models are removed from the entities array and updated ones are added to the end of it. This forces user to do a sorting by id (or any other field in the view layer).
It will be great to preserve the initial order of the models on an update.

Ie, this code should pass:

const testSaveOrder = () => {
  const initialStore = [
    {id: 1, name: 'lol'},
    {id: 2, name: 'lol2'},
    {id: 3, name: 'lol3'},
  ];

  const newStore = mergeStore(
    initialStore, 
    [
      {id: 2, name: 'lol22'},
      {id: 4, name: 'lol4'}
    ]
  );

  expect(newStore).toEqual([
    {id: 1, name: 'lol'},
    {id: 2, name: 'lol22'},
    {id: 3, name: 'lol3'},
    {id: 4, name: 'lol4'}
  ]);
};

testSaveOrder();

Filter Example

Could you add a filter example to your documentation? I'm going to have to find my own implementation due to time constraints, but I would like to see what you think is the correct way to structure a filter w/backbone-redux.

Filter Example: Show Only Completed Todos, or Show Only Open Todos

This could apply to sorts as well, so basically how best to work with flags on backbone collections?

Thanks, this is a solid Lib.

WB

Change syncCollection to allow passing indexMap

For now when you call a syncCollection there is no way to specify what indexes to build, we need to change that.

Possible API to consider:

syncCollection({
  myCollection1: {
    collection: Backbone.Collection,
    indexesMap: {
      fields: {
        byId: 'id'
      },
      relations: {
        byRelationId: 'relation_id'
      }
    },
  myCollection2: {...}
});

Support for both way synchronization

Do you have any plans to add synchronizations in both ways?

Right now, if collection is changed, then store is updated properly. The case to update collection when store is changed is not handled at all, and it seems to be very useful as well.

Clear store on reset action

Now we are calling merge on reset action, but what we really should doing is clear the store for this collection and then do add for a new models.

The edge case is when you store multiple collection in one tree branch (which is not the case for the auto-way, but could be in manual one), so need to think about useful helpers

Don't overwrite reducers when starting to sync

If you have a store with reducers already defined, syncCollection will overwrite them.

It'd be nice if backbone-redux was a bit more friendly to the Redux API.

I guess the main problem is that backbone-redux need to have an handle on the dispatch method. So maybe backbone-redux could be a middleware:

compose(syncCollections({...conf}))(createStore)

What are you using it for?

If you're using backbone-redux in your project, please leave a comment about your experience and problems that you've solved. It will be very interesting to know how you're using backbone + redux and to hear your war stories. Especially if you're using it in some custom and not very automatic way.

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.