reduxjs / redux

A JS library for predictable global state management
https://redux.js.org
MIT License
60.88k stars 15.27k forks source link

Combine reducers clobbering each others state #3523

Closed ghost closed 5 years ago

ghost commented 5 years ago

Do you want to request a feature or report a bug? Bug on account not encountering this behavior before.

(If this is a usage question, please do not post it here—post it on Stack Overflow instead. If this is not a “feature” or a “bug”, or the phrase “How do I...?” applies, then it's probably a usage question.)

What is the current behavior? I have three keys onto combine reducers where i wish to manage unrelated categories of state. Upon updating state with api data i change presentation with my first state 'slice'. im using the compositional form of switch cases on each and handling initial propogation through its default clause.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar. code belongs to a client

What is the expected behavior? expected behavior, each 'slice' of state to be self contained.

Which versions of Redux, and which browser and OS are affected by this issue? Did this work in previous versions of Redux? current npm release all browsers

i need to ask if this is the appropriate usecase for a combined reducer. or if the current meta is to create three store explicitly. ita very hard to keep up with the intents of every package and method but iv been under the impression clobbering data isnt the intent of the store.

this was posted via mobile please forgive any typos

steps to reproduce create a provided store with multiple reducers interact with one and then the other, previous isolated state has been removed upon next interaction with it.

markerikson commented 5 years ago

I'm afraid the question really isn't clear. Can you at least show some fake example could so I can understand the steps you're trying to do?

combineReducers itself works the way it's supposed to, so this definitely isn't a bug. It sounds like it's an attempt to use combineReducers in conjunction with some other code, and the combination isn't behaving the way you expect.

ghost commented 5 years ago

yes sir and thank you this problem is going home with me for the weekend, i have a issue reproduction at home that should be fine for sharing. i just need 2 hours. thank you for being respectful

ghost commented 5 years ago

i think iv found a resolution, thank you for a sanity check @markerikson

markerikson commented 5 years ago

For reference, can you still show an example of what you were trying to do, and what the solution was?