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

Realm.asFlow() is not being triggered on Sync changes. #1070

Closed
cmelchior opened this issue Oct 13, 2022 · 1 comment
Closed

Realm.asFlow() is not being triggered on Sync changes. #1070

cmelchior opened this issue Oct 13, 2022 · 1 comment
Assignees

Comments

@cmelchior
Copy link
Contributor

cmelchior commented Oct 13, 2022

Looks like our Realm.asFlow() isn't being triggered when there is a remote change, whereas queries are being triggered correctly:

realm.asFlow().collect {
  // Is not being triggered when changes are coming from another device
  println("$it -> ${it.realm.version()}")
}
realm.query<FlexParentObject>().asFlow().collect {
  // Works if changes are coming from another device
  println("$it -> ${it.list.size}")
}

This test reproduces the issue: https://github.com/realm/realm-kotlin/pull/1071/files#diff-65ad5644786458a5a2bc5d99f679e8533faf91be5c5ec9aedf806cba336acaefR214

@rorbech
Copy link
Contributor

rorbech commented Jan 10, 2023

Seems to be that we are only initializing the nofitier's internal LiveRealm when we are actually listening for something other that top level realm update. So the realm_add_realm_changed_callback is not registered before listening for something else. An immediate workaround until a fix is ready would be to just trigger some notification, ex.

async { realm.query<X>.asFlow().first {} }

@sync-by-unito sync-by-unito bot closed this as completed Jan 12, 2023
@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.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants