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

No way to access the deleted objects on collection notifications #783

Open
mrackwitz opened this issue Jan 6, 2017 · 4 comments
Open

No way to access the deleted objects on collection notifications #783

mrackwitz opened this issue Jan 6, 2017 · 4 comments

Comments

@mrackwitz
Copy link
Contributor

mrackwitz commented Jan 6, 2017

The docs state this isn't possible yet, but support for this would be coming soon. I haven't found any issue tracking this though.

  // Update UI in response to deleted objects
  changes.deletions.forEach((index) => {
    // Deleted objects cannot be accessed directly
    // Support for accessing deleted objects coming soon...
    ...
  });
@alazier
Copy link
Contributor

alazier commented Jan 10, 2017

Do you need this in the context of the global notifier? If so it exposes the old Realm in which case you should be able to access deleted objects from the old realm.

@mrackwitz
Copy link
Contributor Author

Initially I thought to use plain collection notifications on a synced Realm, but I'm now relying on the global listener instead as a workaround. This is good for now and not blocking me in any way.

@ianpward
Copy link

Found the answer var oldRealm = changeEvent.oldRealm.objects("RealmObject"); let deletedTask = oldRealm[index];

We should expose this in our docs @bigfish24

@kneth
Copy link
Contributor

kneth commented Jul 13, 2023

We need to take up #5081 again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants