matthewmueller / socrates

Small (8kb), batteries-included redux store to reduce boilerplate and promote good habits.
577 stars 14 forks source link

reducer trees not working correctly/consistently. #8

Closed tracker1 closed 8 years ago

tracker1 commented 8 years ago

I've been unable to get reducer trees to work beyond the root level definitions.

matthewmueller commented 8 years ago

yikes, that's no good, can you share the code you're using?

mrbar42 commented 8 years ago

I'm experiencing the same thing.

this works:

Socrates({
 boot(state, action) {
    return action;
  },
  user: {
    update(state, action) {
      return action;
    },
    settings: {
      update (state, action) {
        return action;
      }
    }
  }
})

but this one won't work:

Socrates({
 boot(state, action) {
    return action;
  },
  user: {
    update(state, action) {
      return action;
    },
    settings: {
      update (state, action) {
        return action;
      }
    },
    data: {
      change(state, action) {
        return action;
      }
    }
  }
})

seems like whenever there is more the one key on the same level in the tree the function won't get called at all. the action is processed and even subsribed listeners are invoked.

slaskis commented 8 years ago

I'm having a similar issue.

Here's a requirebin that works: http://requirebin.com/?gist=7bf0e0da55a2b7376fe9

And one that doesn't: http://requirebin.com/?gist=6e046c3a9fa7fa08db27

The only difference is adding an action which catches the History() middleware navigate() action

matthewmueller commented 8 years ago

Sorry about that, I've redone this entirely and tested for this case. It's working now