Skip to content

React Native app crashes when realm.delete(toDelete) is called multiple times or spammed #6978

Open
@ahmadhannan-ammag

Description

my app crashes when this method is called concurrently. Here is my code:

const removeTokenFromRealm = useCallback(
(walletId: string, assetId: string) => {
const toDelete = realm.objects(REALM_TYPE_TOKEN).filtered('walletId = $0 AND assetId = $1', walletId, assetId);

  realm.write(() => {
    try {
      console.log('to delete ', realm.delete);
      realm.delete(toDelete);
    } catch (error) {
      console.log('error deleting token', error);
    }
  })
  
},
[realm],

);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions