SendBird Sync Manager issues

I’m not sure if it’s something wrong with my implementation or an actual error with the package. Everything else except these two cases work perfectly.

When I add a user to a channel, SendBird SyncManager throws this error:

SendBirdSyncManager.min.js?6534:6 Uncaught TypeError: Cannot read property ‘userId’ of null
at eval (SendBirdSyncManager.min.js?6534:6)
at eval (SendBirdSyncManager.min.js?6534:6)
at IDBRequest.e.onsuccess (SendBirdSyncManager.min.js?6534:6)

When I delete a message from a channel, it throws this error:

SendBirdSyncManager.min.js?6534:6 Uncaught TypeError: Cannot read property ‘messageId’ of null
at eval (SendBirdSyncManager.min.js?6534:6)
at eval (SendBirdSyncManager.min.js?6534:6)
at IDBRequest.n.onsuccess (SendBirdSyncManager.min.js?6534:6)

I have to add event handlers on the standard sendbird sdk to handle these situations… however, I’m finding with the delete message one. The message is still cached, so when the user does a hard refresh… the deleted message gets returned.

I’m also curious… we have some additional logic built on top of sendbird that we run via our own api. Is it possible to somehow cache additional data onto channels/messages with Sync Manager?
Lets say, the user loads a channel, the frontend makes an api request to fetch some additional data, I can then add this data to the channel object and update the version cached. So that I don’t need to make an api request for this additional data?

Thanks

1 Like

Another thing… why is there no way to know when we’ve completely loaded?

We have: “channelCollection.query.isLoading” but this is only true when syncing?

Is there a way to know when we’re pulling data from the cache and that we tried to submit it to “onChannelEvent”?

For example. I’m trying to show a screen saying “you have no conversations, you can start one by clicking a connection above” - but… we don’t know when it’s actually done loading, to check the channel count of the user. So it will show the “you have no conversations, you can start one by clicking a connection above” screen, then switch to the channels screen when “onChannelEvent” gets called.

I’ve been pulling my hair out over this for 3 hours now. Why is it so hard to get a loading state?

@SamKK if you want to add some data onto channel or message, you can update custom_type https://sendbird.github.io/core-sdk-javascript/module-model_baseChannel-BaseChannel.html#updateUserMessage https://sendbird.github.io/core-sdk-javascript/module-model_groupChannel-GroupChannel.html#updateChannel

and about the loading state, when you call fetch then you are definitely loading state. Since ChannelCollectionHandler can be called anytime when something changes on channels, you can start displaying channel(s) whether loading is finished or not.

Appreciate your responses, unfortunately not the answers i was looking for :frowning:

Spent the last two days building my own version of “sync manager” to solve my problems. Seems like it was the only way

My team is also running into these same issues in the original post. @Woo any advice or confirmation that these are indeed problems with the SyncManager package?

@jkepps current sync manager has a bug that channel collection’s query doesn’t update properly hence using it is not a good way to check if ever loading is finish or not. If you recently try to use sync manager then I would recommend you to wait for new version of sync manager (which will be implemented in core sdk, and ETA around Q3).

My team and I are running in the same issue. As we are using NextJS, it is obfuscated in our staging and prod envs, but not locally, which is troublesome when developing. We will be looking out for this new version

@Woo
Any updates on this new version? We are looking to implement sync manager in our chat app soon. We want to know if we should use GitHub - sendbird/sendbird-syncmanager-javascript: Sendbird SyncManager for JavaScript is an add-on for reliable chat data caching with Chat SDK features. or if a new version is coming soon.

@Alex_Choi new version of sync manager (It will be shipped within SendbirdSDK) around Oct. We are now in QA process and enhancing test cases. Thanks for your patient!

Hello @Woo. I have just made the mistaken of trying to implement the syncmanager into my react-native app. Only to be suffering from some of the issues managed above. Since October is when the SDK is to be updated, was hoping to get an update? I’m happy to help beta test as well if that’s possible.

I believe its already included in sendbird chat sdk on iOS/Android (not 100% sure about JS, I will ask team about it and let you know on Monday), not GA yet though (I heard its a little bit delayed and will be around 1~2nd week of Nov).