You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation mentions a milestone called data, which I believe is supposed to occur when the values of an entity are changed. I'm attempting to perform some logging of updates, and I need to know which properties of the entity have changed. Unfortunately, there appears to be no milestone between the altering of the properties and the saving of the entity. This means I'm unable to use entity.changed() (because it's either not set yet before write or already cleared after write). Am I missing something here?
EDIT
If the above is correct, it seems like the data milestone could still be implemented without any breaking changes by using this order: before fetch, after fetch, before write, before data, after data, after write. This would keep the behavior of the before write and after write the same--it would just add a couple data milestones in-between to allow some custom behavior between the properties changing and the entity being saved.
The text was updated successfully, but these errors were encountered:
update.write.after is too late. I can't figure out what changed if I wait until then.
I ended up using update.fetch.after because I can at least see what the original values were and compare them with the new values passed in via req.body. The problem is, I then need to perform a diff, which I had to install a special library for (object-diff).
So, having that data milestone, as I've described it above, would have greatly reduced the amount of engineering/code.
Is there a big difference between using the update.fetch.after and the update.write.before? Seems the data would be the same. So why not do it in update.write.before?
The documentation mentions a milestone called
data
, which I believe is supposed to occur when the values of an entity are changed. I'm attempting to perform some logging of updates, and I need to know which properties of the entity have changed. Unfortunately, there appears to be no milestone between the altering of the properties and the saving of the entity. This means I'm unable to useentity.changed()
(because it's either not set yet before write or already cleared after write). Am I missing something here?EDIT
If the above is correct, it seems like the data milestone could still be implemented without any breaking changes by using this order: before fetch, after fetch, before write, before data, after data, after write. This would keep the behavior of the before write and after write the same--it would just add a couple data milestones in-between to allow some custom behavior between the properties changing and the entity being saved.
The text was updated successfully, but these errors were encountered: