Ability to get the "previous" state in the AfterChange Hook #941
AlessioGr
started this conversation in
Feature Requests & Ideas
Replies: 1 comment 1 reply
-
Couldn't you just use the beforeChange hook for that? There you have the data that is going to change and the old state. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Having this would be extremely helpful for https://github.com/TimHal/pcms-backpop
Relevant Discord discussion: https://discord.com/channels/967097582721572934/1004009734115966976/1008803750971981834
Say the primary object has a relationship to the secondary object. The secondary object then has that backpopulated field to the primary object.
If you delete the relationship of the primary relationship which points to the secondary relationship, we would need a way to find out the removed reference of that secondary relationship in the AfterChange hook. Otherwise, it becomes very hard to find the object where the backpopulated field would need to be removed (currently that's only possible via iterating and checking all those object, resulting in crap performance).
Hope this makes sense - what do you think?
Beta Was this translation helpful? Give feedback.
All reactions