Skip to content

Incorrect next state with actions updating slices of state #19

Open
@Beaglefoot

Description

@Beaglefoot

Imagine the following scenario:

const state = {
  counters: {
    count1: 1,
    count2: 2,
    count3: 3
  }
};

const actions = {
  counters: {
    inc1: () => ({ count1 }) => ({ count1: count1 + 1 })
  }
};

Let's run inc1() action and here's what we see...

prev state:

{
  count1: 1,
  count2: 2,
  count3: 3
}

next state:

{ count1: 2 }

What's expected next state:

{
  count1: 2,
  count2: 2,
  count3: 3
}

Right now logger simply returns the result of an action, and I strongly believe that it should return merged slice of a state.
Here's an illustration

BTW, thanks for logger!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions