This is a fork of the @datorama/akita repository to solve a problem we were having where the local storage would reset on refresh.
1954: // when we use the local/session storage we perform the serialize, otherwise we let the passed storage implementation to do it
const isLocalStorage = (hasLocalStorage() && storage === localStorage) || (hasSessionStorage() && storage === sessionStorage);
observify(storage.getItem(key)).subscribe((value) => {
let storageState = isObject(value) ? value : deserialize(value || '{}');
function save(storeCache) {
storageState['$cache'] = Object.assign({}, (storageState['$cache'] || {}), storeCache);
storageState = Object.assign({}, storageState, acc);
//@em843 TODO!!! I changed this so both strategies run serialize
buffer.push(storage.setItem(key, isLocalStorage ? serialize(storageState) : serialize(storageState)));
_save(buffer.shift());
}
Elf, a newer state management solution, has been published. We recommend checking it out π
A Reactive State Management Tailored-Made for JS Applications
Whether it be Angular, React, Vue, Web Components or plain old vanilla JS, Akita can do the heavy lifting and serve as a useful tool for maintaining clean, boilerplate-free, and scalable applications.
Akita is a state management pattern, built on top of RxJS, which takes the idea of multiple data stores from Flux and the immutable updates from Redux, along with the concept of streaming data, to create the Observable Data Stores model.
Akita encourages simplicity. It saves you the hassle of creating boilerplate code and gives powerful tools with a moderate learning curve, suitable for both experienced and inexperienced developers alike.
π 10 Reasons Why You Should Start Using Akita as Your State Management Solution
- π€ Learn about it on the docs site
- π See it in action on StackBlitz
- π Use the CLI
- π Checkout the sample application