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

RealmList remove method is not working. #1477

Closed
ggajews opened this issue Aug 7, 2023 · 1 comment
Closed

RealmList remove method is not working. #1477

ggajews opened this issue Aug 7, 2023 · 1 comment

Comments

@ggajews
Copy link

ggajews commented Aug 7, 2023

How frequently does the bug occur?

Always

Description

RealmList remove element is not removing.

To reproduce:

class Child : RealmObject {
    @PrimaryKey
    var id: Long = 0
}
class Parent : RealmObject {
    var children: RealmList<Child> = realmListOf()
}

realm.write {
            val parent = copyToRealm(Parent())
            parent.children.add(Child().apply { id = 1 })
            assertEquals(1, parent.children.size)
            parent.children.remove(parent.children.first())
            assertEquals(0, parent.children.size)
        }

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

No response

Version

1.10.1

What Atlas App Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

Android 13

Build environment

Android Studio version: ...
Android Build Tools version: ...
Gradle version: ...

@cmelchior
Copy link
Contributor

Hi @ggajews This is happening because the RealmObject equals method is not working correctly. See #1097 ... It appears that this has crept through the cracks and should be fixed.

I'll fold this into #1097

The workaround, for now, could be to either override the equals method yourself.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants