Skip to content

Commit 90b7d60

Browse files
fix: missing init data
1 parent f3ed34e commit 90b7d60

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/livePreview/eventManager/postMessageEvent.hooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function sendInitializeLivePreviewPostMessageEvent(): void {
7575
contentTypeUid,
7676
entryUid,
7777
windowType = ILivePreviewWindowType.PREVIEW,
78-
} = data;
78+
} = data || {};
7979

8080
if (contentTypeUid && entryUid) {
8181
// TODO: we should not use this function. Instead we should have sideEffect run automatically when we set the config.

src/visualBuilder/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ export class VisualBuilder {
251251
const {
252252
windowType = ILivePreviewWindowType.BUILDER,
253253
stackDetails,
254-
} = data;
254+
} = data || {};
255255
Config.set("windowType", windowType);
256256
Config.set(
257257
"stackDetails.masterLocale",
@@ -316,7 +316,7 @@ export class VisualBuilder {
316316
// Remove event listeners
317317
window.removeEventListener("resize", this.resizeEventHandler);
318318
window.removeEventListener("scroll", this.scrollEventHandler);
319-
319+
320320
// Remove custom event listeners
321321
removeEventListeners({
322322
overlayWrapper: this.overlayWrapper,
@@ -328,11 +328,11 @@ export class VisualBuilder {
328328
resizeObserver: this.resizeObserver,
329329
customCursor: this.customCursor,
330330
});
331-
331+
332332
// Disconnect observers
333333
this.resizeObserver.disconnect();
334334
this.mutationObserver.disconnect();
335-
335+
336336
// Clear global state
337337
VisualBuilder.VisualBuilderGlobalState.value = {
338338
previousSelectedEditableDOM: null,
@@ -343,7 +343,7 @@ export class VisualBuilder {
343343
locale: "en-us",
344344
variant: null,
345345
};
346-
346+
347347
// Remove DOM elements
348348
if (this.visualBuilderContainer) {
349349
window.document.body.removeChild(this.visualBuilderContainer);
@@ -357,7 +357,7 @@ export class VisualBuilder {
357357
if (this.focusedToolbar) {
358358
this.focusedToolbar.remove();
359359
}
360-
360+
361361
// Nullify references
362362
this.customCursor = null;
363363
this.overlayWrapper = null;

0 commit comments

Comments
 (0)