Skip to content

RealmSwift.List order not in sync on different clients #6191

@divan84

Description

@divan84

How frequently does the bug occur?

All the time

Description

We found the following problem with conflict resolution in RealmSwift.List: When changing the list order on several devices of which some are online and some are offline, the list order will stay different on the devices even after they were re-synced and are all back online.

We would expect the list order to be the same on all devices after sync. Right now, only if the app is deleted and reinstalled the order is the same again.

Stacktrace & log output

No response

Can you reproduce the bug?

Yes, always

Reproduction Steps

  1. Create a simple app with device sync on
  2. The app should display a simple data model like this:
class Project: Object, ObjectKeyIdentifiable {
    @Persisted(primaryKey: true) public var _id = ObjectId.generate()
    @Persisted public var comments: RealmSwift.List<Comment> = .init()
    @Persisted public var title: String
}
class Comment: Object, ObjectKeyIdentifiable {
    @Persisted(primaryKey: true) public var _id = ObjectId.generate()
    @Persisted public var text: String
}
  1. The list items can be re-ordered
  2. Log in with with at least two users on different devices
  3. One user is offline and randomly changes list order several times
  4. Another user does the same while online
  5. The first user goes back online

Result
The list order on both devices is different and will stay so until the app is deleted and reinstalled.

Version

Realm 10.33.0, RealmDatabase 12.13.0

What SDK flavour are you using?

MongoDB Realm (i.e. Sync, auth, functions)

Are you using encryption?

No, not using encryption

Platform OS and version(s)

iOS 16.1, macOS 13.0

Build environment

Xcode version: 14.2
Dependency manager and version: SPM

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions