From e7691de7bc6af11448cf12cd40356b1d3c4feddd Mon Sep 17 00:00:00 2001 From: Fredrik Karlsson Date: Mon, 8 Jan 2024 17:15:33 +0100 Subject: [PATCH] Fix second save nested layout #1485 --- modules/Cockpit/assets/components/field-layout.tag | 9 +++++++++ modules/Collections/views/entry.php | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/Cockpit/assets/components/field-layout.tag b/modules/Cockpit/assets/components/field-layout.tag index 2473cf0df..fa2fdd3bf 100644 --- a/modules/Cockpit/assets/components/field-layout.tag +++ b/modules/Cockpit/assets/components/field-layout.tag @@ -468,8 +468,17 @@ remove(e) { this.items.splice(e.item.idx, 1); + function checkParent(child) { + if (!child.parent) { + child.update(); + } else { + checkParent(child.parent); + } + } + if (opts.child) { this.parent.update() + checkParent(this); } } diff --git a/modules/Collections/views/entry.php b/modules/Collections/views/entry.php index 74f448818..7346d276a 100755 --- a/modules/Collections/views/entry.php +++ b/modules/Collections/views/entry.php @@ -336,7 +336,7 @@ App.ui.notify("Saving successful", "success"); - _.extend($this.entry, entry); + _.extend(entry, $this.entry); $this.fields.forEach(function(field){