Accessing object of type 'track_info' which has been invalidated or deleted


#1

Please i am new to react native and realm, I am trying to delete a record in the database, but keep getting this error but the record will be deleted.

deleteData(t_id) {
realm.write(() => {
            if (realm.objects('track_info').filtered('track_id =' + t_id).length > 0) {
                realm.delete(realm.objects('track_info').filtered('track_id =' + t_id));
                console.warn("REcord deleted");

               
                Alert.alert(
                    'Successes', 'deleted');
            } else {
               Alert.alert(
                   'Error', 'Record not found, or has been deleted already');
            }

         


        });

    }