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

Don't trigger webhooks on nested relational updates #10509

Closed
3 tasks done
Attacler opened this issue Dec 15, 2021 · 4 comments
Closed
3 tasks done

Don't trigger webhooks on nested relational updates #10509

Attacler opened this issue Dec 15, 2021 · 4 comments
Labels

Comments

@Attacler
Copy link

Preflight Checklist

Describe the Bug

I have 2 collections:
categories and products.
Between those 2 there is a m2m (catagories_products).
Whenever i add a product to a categorie, it will trigger a hook for all products that are already there.
I had a webhook configured on the join table and it basicly tiggered 170 times because there where 170 products in 1 categorie.
It gave a big load on Directus and the target.

To Reproduce

Create 2 collections:

  • Categories
  • products

Add a M2M to them.
Make some way to see if a hook is triggered (for example console.log(1) inside a update hook);
Now add some products to the categories and you will see it getting triggered on the join table.

Errors Shown

No response

What version of Directus are you using?

9.2.2

What version of Node.js are you using?

17.1.0

What database are you using?

Postgres 14

What browser are you using?

Chrome

What operating system are you using?

Linux

How are you deploying Directus?

PM2

@rijkvanzanten rijkvanzanten changed the title Updating a M2M causes all records to trigger an update Updating a M2M causes all related records to trigger an update Dec 15, 2021
@rijkvanzanten rijkvanzanten changed the title Updating a M2M causes all related records to trigger an update Don't trigger webhooks on nested relational updates Dec 15, 2021
@rijkvanzanten
Copy link
Member

The fact that the hook fires is expected, as the actual nested item is being updated. That being said, the webhook should only be fired once for the whole (nested) relational update tree

@rijkvanzanten
Copy link
Member

Ref #11172

@rijkvanzanten
Copy link
Member

Linear: ENG-285

@rijkvanzanten
Copy link
Member

I believe this was resolved as part of #14981, but happy to reopen if I'm mistaken

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
Archived in project
Development

No branches or pull requests

2 participants