简体   繁体   English

将 Sendbird 与 redux-persist 结合使用

[英]Using Sendbird with redux-persist

I am using sendbird chat in react-native android app.我在 react-native android 应用程序中使用sendbird聊天。 In efforts to improve chat perceived speed I am letting users see previous data & load updates async (not showing loader).为了提高聊天感知速度,我让用户看到以前的数据和异步加载更新(不显示加载器)。

I am using sendbird with redux-persist & saving entire Chat reducer object.我正在使用带有redux-persist sendbird 并保存整个Chat reducer 对象。 Most reducer code is taken from https://github.com/sendbird/SendBird-JavaScript/tree/master/react-native-redux-sample .大多数减速器代码取自https://github.com/sendbird/SendBird-JavaScript/tree/master/react-native-redux-sample

Data is being pulled back from persisted state successfully.正在成功地从持久状态中拉回数据。 But it fails while rendering.但是在渲染时失败了。 Functions like isUserMessage , isFileMessage , etc do not exist.不存在isUserMessageisFileMessage等函数。 I tried finding where these functions are defined, but could not find anything except the type definitions .我试图找到这些函数的定义位置,但除了类型定义之外找不到任何东西。

Is there a good way to construct entire redux state back from serialized JSON?有没有一种从序列化的 JSON 构造整个 redux 状态的好方法?

Let me know if you need any more info.如果您需要更多信息,请告诉我。

It's recommended to use SendBird's SyncManager SDK with your application to manage chat data synchronization and allow for local caching in your application.建议在您的应用程序中使用 SendBird 的 SyncManager SDK 来管理聊天数据同步并允许在您的应用程序中进行本地缓存。

Please see the React Native Redux sample with the SyncManager SDK here: https://github.com/sendbird/SendBird-JavaScript/tree/master/react-native-redux-syncmanager-sample请在此处查看带有 SyncManager SDK 的 React Native Redux 示例: https : //github.com/sendbird/SendBird-JavaScript/tree/master/react-native-redux-syncmanager-sample

That said, here is the official JavaScript API documentation for the BaseMessage class that includes the isUserMessage and isFileMessage methods to help in determining the message type: https://sendbird.github.io/core-sdk-javascript/module-model_baseMessage-BaseMessage.html也就是说,这里是 BaseMessage 类的官方 JavaScript API 文档,其中包括用于帮助确定消息类型的isUserMessageisFileMessage方法: https : isFileMessage .html

The message classes include their own buildFromSerializedData methods that may help in rebuilding the state should you need to do so.消息类包括它们自己的 buildFromSerializedData 方法,如果您需要,这些方法可能有助于重建状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM