An after.update hook's modifier doesn't get a before.update's updated modifier
evolross opened this issue · comments
Many times in a before.update
I'll check the incoming modifier
and update it to enforce application rules. A perfect example is sanitizing HTML from a rich-text editor before saving. Simply sanitize the HTML and update modifier.$set.html
.
I just noticed for the first time that the after.update
modifier
does not get these updates. It retains the original modifier
from the update
. I see how this could be important, but if you update the modifier
manually in the before.update
it seems like the after.update
should then see this somehow?
I often refer to the modifier
in after.update
to get around the the issue of replication lag. As usually it's the same as the original update and since we're in after.update
we can assume the update was a success. But when needing to update the modifier
you can't do this work-around.
For now a work-around is to replicate the logic to update the modifier
in after.update
but this of course is not DRY.