Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-1911

Problems with Deleting Record with Realm for React Native

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None

      When I attempt to delete a record, my app instantly crashes and I cannot seem to catch the exception. From the MongoDB support team, it seems the context is being closed too soon. Any idea what is happening? This happens whether I use a listener or not.

      Delete method:

        const deleteList = (listId: string): void => {
          const listRealm = realmRef.current;
          const list = listRealm?.objectForPrimaryKey<List>("List", new ObjectId(listId));
          try {
            listRealm?.write<void>(() => {
              if (list) {
                listRealm?.delete(list);
              }
            })
          } catch(error) {
            console.log(error);
          }
        };
      

      React Native 0.70

      SDK:
      android vRealmJS/10.21.1
      Platform Version:
      31

      MongoDB version 5.0.12

            Assignee:
            kenneth.geisshirt@mongodb.com Kenneth Geisshirt (Inactive)
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: