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

Can I get the previous doc data in the Update event? #697

Closed
mingz-unity opened this issue Dec 2, 2018 · 7 comments
Closed

Can I get the previous doc data in the Update event? #697

mingz-unity opened this issue Dec 2, 2018 · 7 comments

Comments

@mingz-unity
Copy link

mingz-unity commented Dec 2, 2018

Hi coming from collection-hook and wonder if the same feature is available here:

When I am in one of those collection update events, can I have access to the previous value so I can do some change handling? I inspected the runtime class of "e" and it only contains the changed value not the original.

Is there anywhere I can get that?
Thanks

@lukejagodzinski
Copy link
Member

@mingz-unity in the newest Astronomy version you can access the old document in the beforeUpdate event in the following way:

beforeUpdate(e) {
  e.oldDoc; // Do something with the previous document state
}

@mingz-unity
Copy link
Author

Cool cool that's great. Yes I dig into the source code and found out. That's great thanks Luke.

@s7dhansh
Copy link

oldDoc is not available on the server? Is it by design? @lukejagodzinski

@lukejagodzinski
Copy link
Member

@s7dhansh thanks for letting me know that it doesn't work on the server. I've fixed it in jagi:astronomy@2.7.3

@s7dhansh
Copy link

@lukejagodzinski the new version has made the updates take a lot of time. Can you kindly check that? Can we have some way to make it faster when we have disabledEvents for an update?

@lukejagodzinski
Copy link
Member

lukejagodzinski commented Sep 30, 2019 via email

@s7dhansh
Copy link

@lukejagodzinski sorry you can ignore that last comment. It was caused by something else locally.

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

No branches or pull requests

3 participants