Hello,
I am trying out flexible sync for react native and am having some trouble in my initial setup. I have hooked up everything on the Realm UI and have a schema for the user table. The trouble is when I try to write to this realm, I get Cannot write to class user when no flexible sync subscription has been created. Didn’t my initialSubscriptions set up the subscription? Also note that realm.subscriptions is null for some reason.
Thanks!
const config: Realm.Configuration = {
sync: {
error: (e, r) => console.log(e, r),
user,
flexible: true,
initialSubscriptions: {
update: realm => {
console.log(realm);
realm.add(
realm.objects('user').filtered('account_id', user.id),
// This is a named subscription, so will replace any existing subscription with the same name
{name: 'LoggedInUserData'},
);
},
rerunOnStartup: true,
},
} as FlexibleSyncConfiguration,
};
Realm.open(config)
.then(e => {
realmRef.current = e;
console.log(e);
})
.catch(er => console.error(er));