[MGNLHOOK-331] Add children paths when `recursive` is true Created: 24/Jan/23  Updated: 23/Oct/23

Status: Backlog
Project: Magnolia Webhooks
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Story Priority: Neutral
Reporter: Bartosz Staryga Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Team: DeveloperX
Date of First Response:
Epic Link: Webhooks Maintenance (Phase 2)

 Description   

Case
We have a home page with, let's say, 10 subpages. I make changes to the main page and three subpages. On the main page, I click "Publish including subnodes". Webhook sends me a "path" only to the main page - the Next.js rebuilds only the main page, and the other subpages remain unchanged.

Workaround
The `recursive` flag tells that `Publish including subnodes` was used.
The code triggered by the webhook needs to find the subnodes.

Solution
Webhook to add extra parameter when `recursive` is true containing all published children.

e.g 
?eventld=fe38b454-ca13-4c96-bfe7-bba8f0895160&path=%2F777&workspace=website&eventType=PUBLISHED&nodeType=mgnI%3Apage&recursive=true&subnodesPaths=%2F777%2F1,%2F777%2F123&eventDate=2022-06-29T23%3A35%3A47.652

Future
Webhook to also send paths where published paths are referenced



 Comments   
Comment by Christopher Zimmermann [ 24/Jan/23 ]

bstaryga  Thanks for the suggestion.
I like the idea that the webhook tells you that it has published a whole tree somehow.

I'm wondering if webhook should be responsible for sending list of all children. I guess the next app could do that without too much trouble with a rest call to the magnolia instance, right?

Do you think there could be an issue with length of querystring? What if its 100 children? Or 2000?
But a browser is not involved so maybe it is a possibililty..

Have you seen this feature of sending list of items on webhooks feature of other CMS?

Comment by Bartosz Staryga [ 24/Jan/23 ]

I like the idea that the webhook tells you that it has published a whole tree somehow.
This bit is already implemented via the recursive flag

guess the next app could do that without too much trouble with a rest call to the magnolia instance, right?
Yes it could, but that means extra work that developers need to do:

  • Create an endpoint returning only children of nodes
  • Make and extra request to fetch that data

I'm aiming here to make the life of devs easier

Also, the webhook will know exactly which subpages were published, as Magnolia knows if the page was modified. It can send only the published subnodes, not all. In case we have 100 subnodes, we could avoid rebuilding all of them.

Do you think there could be an issue with length of querystring? What if its 100 children? Or 2000?
Using GET, you are correct - no browser, no issue
Using POST - this param is sent as payload  - no issue

Have you seen this feature of sending lists of items on the webhooks feature of other CMS?
Nope, but I did not do any special research

Comment by Marcin Milas [ 02/Feb/23 ]

We're building a POC for our client with Magnolia Headless and NextJS with Revalidation on demand after publishing a page. We have about 200-300 pages with many branches.  We'll try the way with another rest call to magnolia to get the subnodes and see how it works, although it looks like it would be much easier if the weebhook provided the subnodes.

Generated at Mon Feb 12 10:03:12 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.