Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Attempted to assign to readonly property when Deleting Records in Specific Tables on iOS #1847

Open
thrashraf opened this issue Oct 22, 2024 · 1 comment

Comments

@thrashraf
Copy link

Issue: TypeError: Attempted to assign to readonly property When Deleting Records on iOS

  • WatermelonDB version: 0.27.1
  • React Native version: 0.71.0

Description

When attempting to delete records from certain tables in WatermelonDB, I encounter the following error on iOS:

The deletion logic is as follows:

static async deleteMedia(mediaId: string) {
  try {
    return await database.write(async () => {
      const media = await database.collections.get(WorkspacePhotoModel.table).find(mediaId);
      const preparedDelete = media.prepareMarkAsDeleted();
      await database.batch(preparedDelete);
    });
  } catch (error) {
    console.error('Error in deleteMedia', error);
    throw error;
  }
}
@ASufian98
Copy link

I'm currently facing a similar issue on our side, seems like some of my models cannot delete records

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants