Skip to content

Commit 4edaa60

Browse files
committed
PB-390: Nested Page Builder content can fail to save when action is performed quickly
1 parent ecbf4d4 commit 4edaa60

File tree

2 files changed

+13
-15
lines changed
  • app/code/Magento/PageBuilder/view/adminhtml/web

2 files changed

+13
-15
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/js/master-format/render/frame.js

Lines changed: 7 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/master-format/render/frame.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ function countContentTypes(rootContainer: ContentTypeCollectionInterface, count?
142142
function render(message: {stageId: string, tree: TreeItem}) {
143143
return new Promise((resolve, reject) => {
144144
createRenderTree(message.stageId, message.tree).then((rootContainer: ContentTypeCollectionInterface) => {
145-
console.log("createRenderTree");
146145
const element = document.createElement("div");
147146
/**
148147
* Setup an event on the element to observe changes and count the expected amount of content types are
@@ -156,12 +155,13 @@ function render(message: {stageId: string, tree: TreeItem}) {
156155

157156
// Combine this event with our engine waitForRenderFinish to ensure rendering is completed
158157
$.when(engine.waitForFinishRender(), renderFinished).then(() => {
159-
console.log("count " + countContentTypes(rootContainer));
160158
observer.disconnect();
161-
ko.cleanNode(element);
162-
const filtered: JQuery = filterHtml($(element));
163-
const output = decodeAllDataUrlsInString(filtered.html());
164-
resolve(output);
159+
_.defer(() => {
160+
ko.cleanNode(element);
161+
const filtered: JQuery = filterHtml($(element));
162+
const output = decodeAllDataUrlsInString(filtered.html());
163+
resolve(output);
164+
});
165165
});
166166

167167
ko.applyBindingsToNode(
@@ -199,7 +199,6 @@ function createRenderTree(
199199
tree.data,
200200
parent !== null ? tree.children.length : null,
201201
).then((contentType: ContentTypeCollectionInterface) => {
202-
console.log("content type");
203202
// Ensure we retain the original tree ID's
204203
contentType.id = tree.id;
205204
if (tree.children.length > 0) {

0 commit comments

Comments
 (0)