-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:
How frequently does the bug occur?
Always
Description
If I initialize a new named subscription using Expo SDK @50.0.17, Realm 12.8.1 and @realm/react: 0.6.1 the Subscription gets initialized and is working fine. But trying to access it by name is not possible. Loggin realm.subscriptions to the console leads to:
{1: undefined, 2: undefined, ...}.
This my Provider:
import Realm from "realm"; import { ActivityIndicator } from "react-native"; import { RealmProvider, AppProvider, UserProvider } from "@realm/react"; // Models: import { ShoppingItem, ShoppingList } from "../models/ShoppingItem"; import { Adress, PaymentInfo, Transactions, Users } from "../models/Users"; import { Followed } from "../models/Followed"; import { Follower } from "../models/Follower"; import { Recipe, Ingredient, Preparation } from "../models/Recipe"; // Components: import Login from "../components/auth/login"; import { globalStyles } from "../constants/style"; const appId = "********"; export const RealmCustomProvider = ({ children }) => { const realmAccessBehavior = { type: "openImmediately", }; return ( <AppProvider id={appId}> <UserProvider fallback={Login}> <RealmProvider schema={[ ShoppingList, ShoppingItem, Users, Followed, Follower, PaymentInfo, Transactions, Adress, Recipe, Ingredient, Preparation, ]} sync={{ flexible: true, newRealmFileBehavior: realmAccessBehavior, existingRealmFileBehavior: realmAccessBehavior, // initialSubscriptions: { // update: (subs, realm) => { // subs.add(realm.objects("Users")); // }, // rerunOnOpen: true, // }, onError: console.error, }} > {children} </RealmProvider> </UserProvider> </AppProvider> ); };
And this is how the Query should perform on the ListScreen:
const list = useQuery(ShoppingList, (collection) => collection.filtered("_id == $0", id) ); useEffect(() => { const createSubscription = async () => { await list.subscribe({ name: "listSub" }); }; createSubscription(); }, [realm]);
I don't know, if the issue occurs because of initializing this synced realm for the query wrong, but I have tried several, in the different Docs recommended, Ways and everyone leads to the same solution.
Thanks in advance.
Stacktrace & log output
No response
Can you reproduce the bug?
Always
Reproduction Steps
No response
Version
0.6.1
What services are you using?
Both Atlas Device Sync and Atlas App Services
Are you using encryption?
No
Platform OS and version(s)
Expo SDK @50.0.17, Realm 12.8.1 and @realm/react: 0.6.1
Build environment
Which debugger for React Native: ..
Cocoapods version
No response