All Projects → hilkeheremans → redux-persist-seamless-immutable

hilkeheremans / redux-persist-seamless-immutable

Licence: MIT license
Use seamless-immutable with redux-persist v5

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to redux-persist-seamless-immutable

React Native Workshop
Prototyping Airbnb with React Native
Stars: ✭ 21 (-58%)
Mutual labels:  redux-persist
Slopeninja Native
 Slope Ninja App 🎿❄️⛄️
Stars: ✭ 160 (+220%)
Mutual labels:  redux-persist
react-native-typescript-starter
React Native + TypeScript + Redux + Immutable
Stars: ✭ 40 (-20%)
Mutual labels:  seamless-immutable
React Antd Todo
A simple todo list app built with React, Redux and Antd - Ant Design
Stars: ✭ 42 (-16%)
Mutual labels:  redux-persist
React Native Feature Boilerplate
Feature based Architecture for developing Scalable React Native Apps 🚀 using react, redux, sagas and hooks
Stars: ✭ 139 (+178%)
Mutual labels:  redux-persist
Redux Persist Sensitive Storage
redux-persist storage engine for react-native-sensitive-info
Stars: ✭ 209 (+318%)
Mutual labels:  redux-persist
Simple Trello
📋
Stars: ✭ 431 (+762%)
Mutual labels:  redux-persist
react-native-boilerplate
从真实项目中抽离出的一个简单的样板。(A simple boilerplate stripping out of a real project.)
Stars: ✭ 21 (-58%)
Mutual labels:  redux-persist
Redux React Navigation Demos
React-Native + Redux + Redux-Persist + React Navigation ( Authentication Flow with Redux demos)
Stars: ✭ 151 (+202%)
Mutual labels:  redux-persist
crossbones
Fullstackian award, 1707-FSA-NY. a cross-platform barebones react native setup inspired by https://github.com/FullstackAcademy/bones by
Stars: ✭ 19 (-62%)
Mutual labels:  redux-persist
Redux Persist Expo Securestore
redux-persist storage for Expo's SecureStore
Stars: ✭ 61 (+22%)
Mutual labels:  redux-persist
Cnoder
Yet another CNode Flutter App
Stars: ✭ 84 (+68%)
Mutual labels:  redux-persist
eMQTT5
An embedded MQTTv5 client in C++ with minimal footprint, maximal performance
Stars: ✭ 51 (+2%)
Mutual labels:  v5
Slopeninja Frontend
Slope Ninja Frontend 🏂❄️⛄️
Stars: ✭ 39 (-22%)
Mutual labels:  redux-persist
redux-persist-fs-storage
Redux Persist storage engine for React Native file system
Stars: ✭ 40 (-20%)
Mutual labels:  redux-persist
React Native Boilerplate
🚀 React Native Boilerplate Updated
Stars: ✭ 9 (-82%)
Mutual labels:  redux-persist
Flutter Things Todo
An example Todo App using Flutter with advanced features
Stars: ✭ 189 (+278%)
Mutual labels:  redux-persist
React-Redux-Enterprise
A React-Redux boilerplate for enterprise/large scaled web applications
Stars: ✭ 77 (+54%)
Mutual labels:  redux-persist
YOLOv4MLNet
Use the YOLO v4 and v5 (ONNX) models for object detection in C# using ML.Net
Stars: ✭ 61 (+22%)
Mutual labels:  v5
react-native-ultimate-starter
A React Native Ultimate Starter - react-navigation v5 + redux-toolkits + dark and light theme and more.
Stars: ✭ 16 (-68%)
Mutual labels:  redux-persist

Update: just wanted to let you know it's been busy, but I am still actively using this project and will be converting it to TS (or at least adding some typings) and picking up those issues soon.

redux-persist-seamless-immutable

This package lets you use seamless-immutable on a per-reducer basis along with redux-persist v5.

Lots of people seem to have trouble with this, so I decided to cobble together a quick fix.

Update to v2: easy-to-fix breaking change; seamlessImmutableTransformer has changed to seamlessImmutableTransformCreator to better reflect its new status as a function.

Why

Why is this package for me?

You love using seamless-immutable with redux and redux-persist and found yourself enthusiastically upgrading to redux-persist v5.

Having read the redux-persist docs for v5 you already know that it no longer supports top-level immutable state. But you don't use immutable at that level -- you use it on a per-reducer basis, with top-level state still being a POJO.

You trod on. But, even after using a custom transformer, you then find v5 is consistently throwing you state.merge is not a function as soon as any immutable reducer changes state.

Usage

npm i redux-persist-seamless-immutable or yarn add redux-persist-seamless-immutable.

v5

import { seamlessImmutableReconciler, seamlessImmutableTransformCreator } from 'redux-persist-seamless-immutable'

const transformerConfig = {
  whitelistPerReducer: {
      reducerA: ['keyA', 'keyB']
  },
  blacklistPerReducer: {
      reducerB: ['keyC', 'keyD']
  }
}

const fooConfig = {
  key: 'foo',
  storage: LocalStorage,
  stateReconciler: seamlessImmutableReconciler,
  transforms: [seamlessImmutableTransformCreator(transformerConfig)]
}

tranformerConfig

The transformer can accept a config object with the following keys, which will allow you to white or blacklist specific keys per reducer.

{
  whitelistPerReducer: {
      reducerA: ['keyA', 'keyB']
  },
  blacklistPerReducer: {
      reducerB: ['keyC', 'keyD']
  }
}

Credits

The transformation is based on comments over at https://github.com/rt2zz/redux-persist/issues/133. Thanks to @josev55 and @robclouth. Also kind thanks to @aaronisme and @tasos14 for their contributions!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].