jiti-meet/react/features/base/redux
damencho 06ce24527e fix: Escapes some keys when parsing input. 2021-06-02 15:24:13 -05:00
..
MiddlewareRegistry.js flow: tame the beast 2019-03-21 14:47:55 +01:00
PersistenceRegistry.js fix: Escapes some keys when parsing input. 2021-06-02 15:24:13 -05:00
README.md redux: move PersistenceRegistry to the redux feature 2020-06-16 11:24:15 +02:00
ReducerRegistry.js flow: tame the beast 2019-03-21 14:47:55 +01:00
StateListenerRegistry.js feat(StateListenerRegistry): add 'deepEquals' option 2020-07-16 10:14:59 -05:00
functions.js Remove some Flow annotations 2019-03-25 13:53:08 +01:00
index.js redux: move PersistenceRegistry to the redux feature 2020-06-16 11:24:15 +02:00
logger.js logging: use individual, names loggers 2019-08-23 10:57:38 +02:00
middleware.js fix(misc) follow-up typos 2021-03-22 10:41:41 +01:00

README.md

Jitsi Meet - redux state persistence

Jitsi Meet has a persistence layer that persists specific subtrees of the redux store/state into window.localStorage (on Web) or AsyncStorage (on mobile).

Usage

If a subtree of the redux store should be persisted (e.g. 'features/base/settings'), then persistence for that subtree should be requested by registering the subtree with PersistenceRegistry.

For example, to register the field displayName of the redux subtree 'features/base/settings' to be persisted, use:

PersistenceRegistry.register('features/base/settings', {
    displayName: true
});

in the reducer.js of the base/settings feature.

If the second parameter is omitted, the entire feature state is persisted.

When it's done, Jitsi Meet will automatically persist these subtrees and rehydrate them on startup.

Throttling

To avoid too frequent write operations in the storage, we utilize throttling in the persistence layer, meaning that the storage gets persisted only once every 2 seconds, even if multiple redux state changes occur during this period. The throttling timeout can be configured in

react/features/base/storage/middleware.js#PERSIST_STATE_DELAY

Serialization

The API JSON.stringify() is currently used to serialize feature states, therefore its limitations affect the persistency feature too. E.g. complex objects, such as Maps (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) or Sets (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) cannot be automatically persisted at the moment. The same applies to Functions (which is not a good practice to store in Redux anyhow).