We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How Can I rehydorate model class extended Immustable.Record
This is part of my code.(don't work properly)
my model
export interface IUsers { users: List<IUser>; } export const UsersRecord = Record<IUsers>( { users: List(), }, 'UsersRecord', ); export class UsersModel extends UsersRecord{ addUser() { return this.set( 'users', this.users.push(new UserRecord({name: 'test user'})), ); } }
my store configure
export const createRootReducer = () => combineReducers({ auth: authReducer, users: usersReducer, }); const persistConfig = { key: 'root', storage: AsyncStorage, transforms: [ immutableTransform({ users: [UsersRecord], }), ], }; const persistedReducer = persistReducer(persistConfig, createRootReducer());
handle model instance
return Object.assign({}, state, {users: state.users.addUser()});
warning
TypeError: state.users.addUser is not a function
It seems redux-persist not restore the users as UsersModel, but
Before implementing redux-persist, state.users.addUser was a function object,and worked fine. Could you help me??
"react": "16.9.0", "react-native": "0.61.5", "react-redux": "^7.2.0", "redux-persist-transform-immutable": "^5.0.0", "redux-persist": "^6.0.0",
The text was updated successfully, but these errors were encountered:
@Yoshihide-Nishimoto Hey did you find any resolution, I am facing the same issue
Sorry, something went wrong.
No branches or pull requests
How Can I rehydorate model class extended Immustable.Record
This is part of my code.(don't work properly)
my model
my store configure
handle model instance
warning
It seems redux-persist not restore the users as UsersModel, but
Before implementing redux-persist, state.users.addUser was a function object,and worked fine.
Could you help me??
The text was updated successfully, but these errors were encountered: