Crashed on recyclerview

Scenario: creating a record from mobile and then syncing the record with MongoDB altas then update it on web side on same time I am on same list so when I click on list item it is crashing

Fatal Exception: java.lang.IllegalStateException Access to invalidated List object

io.realm.internal.OsList.nativeSize ( io.realm.internal.OsList.size ( io.realm.ManagedListOperator.size ( io.realm.RealmList.size ( (MedicineSubOrderItemAdapter.kt:53) androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep1 ( (

override fun getItemCount(): Int = medicineItemList.size  // Crashing on this line

i have tried the .isValid() object but i am unable to use that on the above function

@kunal_gharate : Can you send some more details like GitHub repo(which would be great) or how are you accessing data and passing to adapter, if you have figured out how to fix the issue.