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

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