Data Sync incomplete on collections that app does not insert #6346
Labels
Encryption:Off
Frequency:Always
Needs-Attention
Reporter has responded. Review comment.
O-Community
Repro:Always
SDK-Use:Sync
T-Bug
How frequently does the bug occur?
Always
Description
Hi, I am using realm on react native
The issue is that when I tried to query collections that I do not insert on app (users for example) the app does not sync the data for that collection and I cant query that.
Why isn't it syncing all collections that is declared on de realm context config ?
Real examples:
// Collection that has some inserts on app: //
type GenerateProps = {
title: string;
banner?: string;
text: string;
structs: string[];
sticked?: boolean;
urgent?: boolean;
};
export class News extends Realm.Object {
_id!: Realm.BSON.UUID;
title!: string;
banner!: string;
text!: string;
createdAt!: Date;
structs!: string[];
deleted!: boolean;
static generate({
title,
banner,
text,
createdBy,
structs,
sticked,
urgent,
}: GenerateProps) {
return {
_id: new Realm.BSON.ObjectID(),
title,
banner,
text,
createdBy: new Realm.BSON.ObjectID(createdBy),
createdAt: new Date(),
structs,
sticked,
urgent,
};
}
static schema: ObjectSchema = {
name: "News",
};
}
// Collection that has not any insert on app: //
export class Users extends Realm.Object {
_id!: Realm.BSON.UUID;
name!: string;
document!: string;
register!: string;
"__v": number;
createdAt!: Date;
email!: string;
fcmToken?: string;
updatedAt?: Date;
static schema: ObjectSchema = {
name: "Users",
};
}
// realm context config: //
const realmAccessBehavior: Realm.OpenRealmBehaviorConfiguration = {
type: Realm.OpenRealmBehaviorType.OpenImmediately,
};
export const syncConfig: any = {
flexible: true,
newRealmFileBehavior: realmAccessBehavior,
existingRealmFileBehavior: realmAccessBehavior,
};
export const { RealmProvider, useRealm, useQuery, useObject } =
createRealmContext({
schema: [News, Users],
schemaVersion: 1,
});
// realm sync useEffect: //
useEffect(() => {
realm.subscriptions.update((mutableSubs, realm) => {
const news = realm.objects("News");
const users = realm.objects("Users");
}, [realm]);
Not including the appProvider and etc.. because I think it is standart.
Using Anonymous session on attlas
News Collection is working as normal but users has never synced any data from atlas
Is there any missing config ?
Stacktrace & log output
No response
Can you reproduce the bug?
Always
Reproduction Steps
No response
Version
@realm/react: 0.6.2 realm: 12.5.0
What services are you using?
Atlas Device Sync
Are you using encryption?
No
Platform OS and version(s)
React Native 0.72.6, expo
Build environment
Which debugger for React Native: ..
Cocoapods version
No response
The text was updated successfully, but these errors were encountered: