FeatureFuel
1

bypass update emit action if collection/field has't changed by an API call

Source: directus/directus#23758 · opened by @mahendraHegde
Summary


I have a collection called users and a json field called settings, I run an expensive task on action hook, when settings fields of a users is updated, i want to be able to skip this action if there was no change made to the the field by the update api call, i skip the action if payload.settings is undefined, but how can i skip the action if payload.settings === userBeforeUpdate.settings

Explored options,
1. in action, fetch the user and compare user.settings with payload.settings, this wont work because at this point DB is already updated and condition will always return true
2. in filter, check if the payload.settings is same as user.settings(by reading user from DB), if so, set some custom boolean field in payload(ex payload.settings.updated=true/false indicating, whether the update mutated the user or not. This works, but is there a cleaner and more optimal approach?

No pledges yet. Be the first to back this.

Make a pledge

Pledge your monetary support if this feature is added.

$

Comments

No comments yet.

Replying to

Add a comment

What do you think about this feature request?


Similar requests