Sync Progress an sync not acting as expected


I’ve got a synced realm (25k objects) in studio (cloud) and am able to query it and to sync it for offline use. But the synchronisation acts a bit weird. I have a progressNotification listener:

const progressCallback = (transferred, transferables) => {
    if (transferred < transferables) {
        // Show progress indicator
        console.log("PR",transferred, transferables)
    } else {
        // Hide the progress indicator

The output from the progress indicator is not increasing but it shows randomly numbers, from one to five times during sync process and transferred is always equal transferables. As I understand it, it should show downloaded bytes and total bytes.
Sometimes it just shows what I guess is the transferable number (total bytes).
In that manner it is obviously impossible to track the progress.
I also have the impression that I have to start the sync process 2-3 times until all data is synced. It eventually happens but it would be nice to have a reliable way to track the sync process.

This is how I open the realm and subscribe to changes ( from my understanding this is the process of syncing and transferring the data to the local realm):

        const realm = await{
          path: 'plx1.realm',
          sync: {
            user: Realm.Sync.User.current,
            url: `realms://${SERVER}/cars`,
            error: (session,err) => Reactotron.log("SE",err),
            validate_ssl: false,
            fullSynchronisation: false,
            partial: true,
            readOnly: true
          schema: [PlacesSchema]
        }).then(realm => {
          let results = realm.objects("cars");
          let subscription = results.subscribe();
          realm.syncSession.addProgressNotification('upload', 'forCurrentlyOutstandingWork', progressCallback);
          realm.syncSession.addProgressNotification('download', 'forCurrentlyOutstandingWork', progressCallback);
        }).catch(e => console.error(e));

What am I doing wrong?


I figured it out. The progress notifications are apparently not continous but are fired at certain times. With most of my queries this happens twice. At the beginning and when the synchronisation is done.

No progress bar then, but it’s enough for a spinner (not .
critical since the sync process is really fast - just a few sconds for 5k objects)