wwayne / redux-reset Goto Github PK
View Code? Open in Web Editor NEWGive redux the ability to reset the state
License: MIT License
Give redux the ability to reset the state
License: MIT License
Hi, I believe this package has some issues with redux-persist v5. Basically it's like it resets the state but the redux-persist package for some reason doesn't write the updated state to the storage system (asyncstorage in my situation).
But if I create a reset action by hand (that brings the state to its initial state), it works correctly. I'm integrating your package like this:
createStore(
rootReducer,
undefined,
compose(
applyMiddleware(
thunkMiddleware,
loggerMiddleware,
),
reduxReset('RESET_APP')
)
)
What may be causing this issue?
I am implementing a logout in a project, where I want to keep a certain key from the state from resetting after calling reduxReset. I am also using redux-persist, which I've heard causes some trouble.
The key is "netInfo," where internet connection is evaluated and saved. After reduxReset, this variable becomes undefined. Only after closing and re-opening the app does this issue get fixed.
Ie. resetRedux(exception(state.config.dontResetThisVal))
Basically I have a config var in the store I dont want to ever reset.
Hello, do you mind adding support for this?
reduxjs/redux#658 (comment)
function makeHydratable(reducer, hydrateActionType) {
return function (state, action) {
switch (action.type) {
case hydrateActionType:
return reducer(action.state, action);
default:
return reducer(state, action);
}
}
}
// later
store.dispatch({
type: HYDRATE_STATE,
state: initialState
});
Woo, but the way, just figured out you are in wiredcraft!
The Wiredcraft Blog is incredibly awesome ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.