hilkeheremans / redux-persist-seamless-immutable Goto Github PK
View Code? Open in Web Editor NEWUse seamless-immutable with redux-persist v5
License: MIT License
Use seamless-immutable with redux-persist v5
License: MIT License
Hi, thanks for you efforts!
However, I'm having problems compiling this.
./node_modules/redux-persist-seamless-immutable/src/reconciler.js
Module parse failed: Unexpected token (9:19)
You may need an appropriate loader to handle this file type.
| { debug, mergeDeep = false }
| ) => {
| let newState = { ...reducedState };
| // only rehydrate if inboundState exists and is an object
| if (inboundState && typeof inboundState === 'object') {
My project uses create-react-app.
Node: v8.8.0
Hello.
On using nested persist with a transform to seamless-immutable has a failure.
Transformer returns a plain js object. Not seamless-immutable.
On root level all right.
I'm looking into using this library since I'm currently using seamless-immutable lib and an old version of redux persist.
I was wondering if this Reconciler matches autoMergeLevel2?
Thank you for your work on this lib 🥇
Any idea what causing this:
Here's my codes:
import { createStore, applyMiddleware } from 'redux';
import { createLogger } from 'redux-logger';
import { persistReducer } from 'redux-persist';
import FilesystemStorage from 'redux-persist-filesystem-storage';
import { seamlessImmutableReconciler, seamlessImmutableTransformCreator } from 'redux-persist-seamless-immutable';
import reducers from '../reducers';
const transformerConfig = {
whitelistPerReducer: {
teams: ['logos'],
},
blacklistPerReducer: {
competitions: ['items'],
},
};
const persistConfig = {
key: 'root',
storage: FilesystemStorage,
stateReconciler: seamlessImmutableReconciler,
transforms: [seamlessImmutableTransformCreator(transformerConfig)],
};
const persistedReducer = persistReducer(persistConfig, reducers);
const isDebuggingInChrome = __DEV__ && !!window.navigator.userAgent;
const logger = createLogger({
predicate: () => isDebuggingInChrome,
collapsed: true,
duration: true,
});
const createStoreWithMiddleware = applyMiddleware(logger)(createStore);
const store = createStoreWithMiddleware(persistedReducer);
if (isDebuggingInChrome) {
window.store = store;
}
export default store;
However if I pass empty config object const transformerConfig = {};
everything works fine!
The npm package has sloppy bundling. Let's fix that with @pika/pack..
Since I'm converting some of my other code to TS, let's convert this as well and do whatever's needed to publish this for various platforms/ES versions.
See also rt2zz/redux-persist#133
Hello, I'm getting following error. how can i fix it? Thanks!
Config:
const transformerConfig = {
whitelistPerReducer: {
},
blacklistPerReducer: {
}
}
Error:
transformer.js:32 Uncaught TypeError: Cannot convert undefined or null to object
at Function.keys ()
at transformer.js:32:1
at Object._in [as in] (createTransform.js:16:1)
at createPersistoid.js:66:1
at Array.reduce ()
at processNextKey (createPersistoid.js:65:1)
At times the reconciler fails to merge and throws this error.
I was unable to pin point when exactly this happens or why.
Presumably after larger state structure change.
Uncaught (in promise) TypeError: Cannot read property ‘merge’ of undefined
at reconciler.js:34
at Array.forEach (<anonymous>)
at s (reconciler.js:16)
at persistReducer.js:91
at n (reduxsauce.js:229)
at l (createStore.js:165)
at middleware.js:71
at index.js:48
at Object.dispatch (middleware.js:66)
at Object.l [as rehydrate] (persistStore.js:87)
at persistReducer.js:57
(anonymous) @ reconciler.js:34
s @ reconciler.js:16
(anonymous) @ persistReducer.js:91
n @ reduxsauce.js:229
l @ createStore.js:165
(anonymous) @ middleware.js:71
(anonymous) @ index.js:48
(anonymous) @ middleware.js:66
l @ persistStore.js:87
(anonymous) @ persistReducer.js:57
Promise.then (async)
(anonymous) @ persistReducer.js:56
Promise.then (async)
(anonymous) @ persistReducer.js:52
n @ reduxsauce.js:229
l @ createStore.js:165
(anonymous) @ middleware.js:71
(anonymous) @ index.js:48
(anonymous) @ middleware.js:66
s.persist @ persistStore.js:96
o @ persistStore.js:99
t.a @ CreateStore.js:37
t.a @ index.js:47
(anonymous) @ App.js:14
t @ bootstrap abaa5d98ccee410482ed:19
(anonymous) @ main.b4c585ff.js:71680
t @ bootstrap abaa5d98ccee410482ed:19
(anonymous) @ main.b4c585ff.js:65389
t @ bootstrap abaa5d98ccee410482ed:19
(anonymous) @ bootstrap abaa5d98ccee410482ed:62
(anonymous) @ bootstrap abaa5d98ccee410482ed:62
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.