Make web use the redux settings/profile

This commit is contained in:
zbettenbuk
2018-05-09 15:20:22 +02:00
committed by Saúl Ibarra Corretgé
parent ab7e572162
commit 959db3a665
29 changed files with 455 additions and 434 deletions
+17 -6
View File
@@ -6,18 +6,20 @@ 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/profile'`), then persistence for that subtree should be
`'features/base/settings'`), then persistence for that subtree should be
requested by registering the subtree with `PersistenceRegistry`.
For example, to register the field `profile` of the redux subtree
`'features/base/profile'` to be persisted, use:
For example, to register the field `displayName` of the redux subtree
`'features/base/settings'` to be persisted, use:
```javascript
PersistenceRegistry.register('features/base/profile', {
profile: true
PersistenceRegistry.register('features/base/settings', {
displayName: true
});
```
in the `reducer.js` of the `base/profile` feature.
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.
@@ -31,3 +33,12 @@ 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).