Comments (2)
I think what you're trying to achieve is better done at reducer side, not actions.
So imagine you have a reducer for your page's state. It's composed of some smaller ones, among which is the operation state (IAPIOperation
):
const pageReducer = combineReducers({
someOperation: operationReducer,
// some other sub-states
});
It actually makes sense to completely reset the page state when you leave it, not the particular parts of it. So I would go with something like:
const pageReducer = combineReducers({
someOperation: operationReducer,
// some other sub-states
});
const finalStateReducer = (state, action) => {
if (/* action is the page change */) {
// reset state
return pageReducer(undefined, action);
}
return pageReducer(state, action);
};
from typescript-fsa.
I'm going to close this, please feel free to reopen.
from typescript-fsa.
Related Issues (20)
- Amazing project, thank you! 🎉 HOT 1
- Typing issues with react-redux connect and class components HOT 9
- Some breakage with new 3.0 beta HOT 12
- Version 10 of node.js has been released
- Allow For Passing Meta Type ActionCreatorFactory.async and AsyncActionCreators HOT 1
- `.case` allows properties to be return that aren't in the declared `initialState` HOT 2
- Success results are always optional now HOT 2
- Action with unknown payload (TypeScript 3) HOT 2
- payload with default values? HOT 1
- connect(, mapDispatchToProps) not working properly with async functions HOT 2
- Feature request: Add optional mapPayload parameter HOT 2
- Changing interface to type for ActionCreator<P> in 3.0-beta-2 HOT 12
- Might be useful to have examples folder HOT 1
- match incompatible for TypeScript 3.3.4 later HOT 3
- Potentially inspirational Project using typescript-fsa
- Time to release this as non-beta? HOT 2
- TypeScript 3.6 Compatibility issue HOT 2
- Optional parameters not respected in 3.0.0 HOT 3
- Bug: can't create an action without payload. 'ActionCreator<void>' is not assignable to '() => void' HOT 7
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 typescript-fsa.