currentUser undefined when using SyncManager without sendbird connection

Hi everyone, we are running into an issue when using SyncManager. If sb.connect fails (when offline), we still want to initialize syncmanager to rehydrate the application state/chat views. However, the sendbird instance does not have a currentUser defined. Is there a way to cache the current sendbird instance, or repopulate the sendbird instance with a cached user after the initial connection fails? Hopefully this makes sense. We don’t see much value in using SyncManager if the user isn’t also cached because this is causing issues when sending messages – if the currentUser property isn’t defined on the current sendbird instance, deleting/retrying messages doesn’t work. We know local caching is being developed, but it doesn’t work for react-native at the moment.

Without a connection you can fetch group channels. Let’s say you have

function initAndConnect(callback) {
    // Init Sendbird
    sb = new SendBird({ appId: APP_ID });
    // Connect to chat
    sb.connect(USER_ID, ACCESS_TOKEN, (user, error) => {
        if (error) {
            callback(null);
        } else {
            callback(user);
        }
    })
}

And another function to initialise SyncManager:

function initSyncManager(callback) {
    const options = new SendBirdSyncManager.Options();
    options.messageCollectionCapacity = 2000;
    options.messageResendPolicy = 'manual';
    options.maxFailedMessageCountPerChannel = 5;

    SendBirdSyncManager.sendBird = sb;
    SendBirdSyncManager.setup(USER_ID, options)
        .then(() => {
            console.log('At this point, the database is ready.');
            console.log('You may not assume that a connection is established here.');
            callback();
        })
        .catch(error => {
            console.log('SyncManager init failed: ', error);
        });
}

And one last one for getting you channels:

function fetchChannels() {
    const listQuery = sb.GroupChannel.createMyGroupChannelListQuery();
    const collection = new SendBirdSyncManager.ChannelCollection(listQuery);
    const handler = new SendBirdSyncManager.ChannelCollection.CollectionHandler();

    handler.onChannelEvent = (action, channels) => {
        switch (action) {
            case 'insert':
                console.log('Your cached channels are shown here.');
                console.log(channels);
                break;
         }
    };
    collection.setCollectionHandler(handler);
    collection.fetch();
}

This function gets the channels only if you are connected:

function getGroupChannels() {
    var listQuery = sb.GroupChannel.createMyGroupChannelListQuery();
    listQuery.includeEmpty = true;
    listQuery.memberStateFilter = 'all';
    listQuery.order = 'latest_last_message';
    listQuery.limit = 15;
    if (listQuery.hasNext) {
        listQuery.next((groupChannels, error) => {
            console.log('You are connected. These are your channels', groupChannels);
        })
    }
}

So, if you first try to connect (and fail), the SyncManager should work.

initAndConnect((user) => {
    console.log('Connected to sendbird', user);
    if (user) {
        getGroupChannels();
    }
    initSyncManager(() => {
        fetchChannels();
    });
})