realm / realm-kotlin

Kotlin Multiplatform and Android SDK for the Realm Mobile Database: Build Better Apps Faster.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RealmSingleQuery with flow doesn't provide latest updates

gauravbordoloi opened this issue · comments

How frequently does the bug occur?

Always

Description

When we use the below code for getting object change results, it doesn't work.

dbModule.getRealm()
            .query(SaleModel::class, "_id == $0", RealmUUID.from(id))
            .first()
            .asFlow()
            .cancellable()
            .mapLatest {
                it.obj
            }

I have to do like below to get the results

dbModule.getRealm()
            .query(SaleModel::class, "_id == $0", RealmUUID.from(id))
            .asFlow()
            .cancellable()
            .mapLatest {
                it.list.firstOrNull()
            }

Do RealmSingleQuery not support object change?

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

No response

Version

1.13.0

What Atlas App Services are you using?

Local Database only

Are you using encryption?

Yes

Platform OS and version(s)

Android 13

Build environment

No response

Hi @gauravbordoloi We have a test for this scenario here:

So it should work.

Can you provide a fully working sample where it doesn't work?