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

An after.update hook's modifier doesn't get a before.update's updated modifier #265

Open
evolross opened this issue Sep 7, 2020 · 0 comments
Labels

Comments

@evolross
Copy link
Contributor

evolross commented Sep 7, 2020

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.

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

No branches or pull requests

2 participants