Flexible device sync while client is offline. (React native SDK)

Hello developers,

I have a scenario where I need the application user to be able to log in while online. After logging in, the sync should be paused on the client side. The user should then be able to use the app offline (without network connectivity), creating and updating documents locally for two or three days. When the offline period (the period during which the user is either offline or the user is online but the sync is disabled) ends or the user has completed all necessary updates, I should be able to resume the synchronization process.

Currently, I’ve configured the flexible sync as per the documentation, and the user is able to log in successfully. The synchronization appears to be working properly, with both pause and resume functions operational while online. However, when I turn off the network connection and restart the app while offline, the cached user remains present, and the local Realm database is functional, as I can observe documents being queried.

The issue arises when, after a few seconds or milliseconds, the app repeatedly throws the following error in the console:

 [error] App: request location failed (CustomError -1): request to https://realm.mongodb.com/api/client/v2.0/app/*[app-id]*/location failed, reason: Network request failed

and the app components start re-rendering continuously.
I don’t understand what am I missing or is it that way.
How can I be able to persist disabled sync on client across app restarts?

Here is my AppWrapper:

import { useState } from 'react';
import { AppProvider, UserProvider, useApp } from '@realm/react';
import Realm from 'realm';

import { schemas } from '../../models';

import { RealmProvider } from '@realm/react';
import { OpenRealmBehaviorType, OpenRealmTimeOutBehavior, SyncError } from 'realm';
import { LoginScreen } from '../LoginScreen';
import SyncFallback from '../SyncFallback';

const AppWrapper: React.FC<{
  appId: string;
  children: React.ReactNode;
}> = ({ appId, children }) => {
  const [syncError, setSyncError] = useState<SyncError | null>(null);
  // If we are logged in, add the sync configuration the the RealmProvider and render the app

  const realmAccessBehavior: Realm.OpenRealmBehaviorConfiguration = {
    type: OpenRealmBehaviorType.OpenImmediately,
    timeOutBehavior: OpenRealmTimeOutBehavior?.OpenLocalRealm ?? 'openLocalRealm',
    timeOut: 1000,
  };

  return (
    <AppProvider id={appId}>
      <UserProvider fallback={<LoginScreen />}>
        <RealmProvider
          schema={schemas}
          fallback={<SyncFallback err={syncError} />}
          sync={{
            flexible: true,
            existingRealmFileBehavior: {
              type: OpenRealmBehaviorType.OpenImmediately,
            },
            newRealmFileBehavior: realmAccessBehavior,
          }}
        >
          {children}
        </RealmProvider>
      </UserProvider>
    </AppProvider>
  );
};

export default AppWrapper;

Is there nobody, to help me out with this. :worried:
I’m wondering having posted the topic two day ago and not a single person,
not even from realm team at Mongo DB replied. :thinking: