Comments (3)
I don't have a whole answer for you, only one part.
Your reducer is mutating some of the state, instead of recreating it all. You have this line:
updatedWinnings.claimed[indexOfWinningInClaimed].isPending = false
... which changes the value of isPending
on one item from a collection. However, you are not then making a new item with the new property value; you are returning the same item with the value mutated. Also, you are not returning a new .claimed
array; only the same array with one property of one member changed. Because of this, the store
->selectors
->connect()
->props
->shouldComponentUpdate()
sections of the component lifecycle will (probably) not notice that updatedWinnings.claimed[indexOfWinningInClaimed]
has changed.
You could try modifying this reducer to make a new updatedWinnings.claimed
array, with a new [indexOfWinningInClaimed]
item, with the new .isPending
value.
My preference would be to extract more and more specialised reducers. The one you have now operates on the collection. Make a new one which operates on an item in the collection (handling any actions it may need). You might need to go deeper still if the other data in updatedWinnings.claimed[indexOfWinningInClaimed]
is rich and nested.
from redux-actions.
(This is likely not a problem with redux-actions
. You might get better answers if you ask again on StackOverflow with a [redux]
tag. However, redux-actions
can help you: its handleActions()
function makes it much easier to create layers of reducers with pass smaller and smaller pieces of state, and the action, to one another.)
from redux-actions.
@simondell thanks, yes that was not related to redux-actions
. Closed.
from redux-actions.
Related Issues (20)
- Can we have an alias function that is called createActionCreator()? HOT 3
- Consider changing to different version of node.js
- redux-actions 使用createActions出现问题Unexpected end of JSON input iOS无问题 Android有问题
- [Feature request] Function value for defaultState HOT 1
- it's support immutable.js?
- can't use Map on handleActions HOT 2
- combine-actions prefixing bug
- Error handling on action payload HOT 2
- Docs: broken link
- Suddenly can't add an action... HOT 3
- How to use react hooks aftrer reducer change for the lib?
- Looking for Maintainers
- React SSR handleActions cache bug HOT 1
- handleActions with Immer. HOT 1
- Wierd behavior with just not recognizing string templated reducer HOT 1
- 'to-camel-case' pacakge introducing bug since it's not compatible with 'lodash.camelCase' HOT 1
- v3.0.0 + TypeScript Cannot find module 'redux-actions' from ... HOT 12
- Import fails to identify entry point HOT 2
- can redux-actions be used with redux-thunk?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redux-actions.